<random>

公有成員函式 (public member function)
<random>

std::normal_distribution::reset

void reset();
重置分佈
重置分佈,以便該物件的後續使用不依賴於它已經產生的值。

如果此分佈類的庫實現產生獨立值,則此函式可能無效。

引數



返回值



示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// normal_distribution::reset
#include <iostream>
#include <random>

int main()
{
  std::default_random_engine generator;
  std::normal_distribution<double> distribution(0.0,1.0);

  // print two independent values:
  std::cout << distribution(generator) << std::endl;
  distribution.reset();
  std::cout << distribution(generator) << std::endl;

  return 0;
}

可能的輸出
-0.121966
0.68429


複雜度

常量。

另見