Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::mersen...ister_engine(3) C++ Standard Libarystd::mersen...ister_engine(3)

NAME
       std::mersenne_twister_engine::mersenne_twister_engine		     -
       std::mersenne_twister_engine::mersenne_twister_engine

Synopsis
	  mersenne_twister_engine()    :				   (1)
       (since C++11)
	  mersenne_twister_engine(default_seed)	{}
	  explicit   mersenne_twister_engine(  result_type  value  );	   (2)
       (since C++11)
	  template<  class  Sseq   >					   (3)
       (since C++11)
	  explicit mersenne_twister_engine( Sseq& s );
	  mersenne_twister_engine(   const   mersenne_twister_engine&  );  (4)
       (since C++11)
									 (im-
       plicitly	declared)

	  Constructs the pseudo-random number engine.

	  1) Default constructor. Seeds	the engine with	default_seed.
	  2) Constructs	the engine and initializes the state (n	values X
	  i of type result_type) as follows: value mod 2w
	  is used to initialize	X
	  0 and	the rest are initialized iteratively, for i=1-n,...,-1,	each X
	  i is initialized to [f(X
	  i-1xor(X
	  i-1rshift(w-2)))+i mod n] mod	2w
	  3) Constructs	the engine and initializes the state by	calling	s.gen-
       erate(a,	a+n*k)
	  where	a is an	array of length	n*k and	k is ceil(w/32)	and then,  it-
       eratively for
	  i=-n,...,-1, setting each element of the engine state	X
	  i to (k-1
	  j=0a
	  k(i+n)+j}232j
	  ) mod	2w
	  , and	finally	if the most significant	w-r bits of X
	  0 are	zero, and if all other X
	  i are	zero, replacing	X
	  0 with 2w-1
	  .

	  Note:	 initialization	 requirements are based	on the 2002 version of
       Mersenne	Twister,
	  mt19937ar.c

	  The overload (3) only	participates in	overload  resolution  if  Sseq
       qualifies as a
	  SeedSequence.	 In  particular, it is excluded	from the set of	candi-
       date functions if
	  Sseq is convertible to result_type.

Parameters
	  value	- seed value to	use in	the  initialization  of	 the  internal
       state
	  s	 -  seed sequence to use in the	initialization of the internal
       state

Complexity
	  linear in n (the state size)

	 Defect	reports

	  The following	behavior-changing defect reports were applied retroac-
       tively to
	  previously published C++ standards.

	    DR	  Applied to	  Behavior as published	      Correct behavior
	  P0935R0 C++11	     default constructor was explicit made implicit

See also
	  seed	  sets the current state of the	engine
	  (C++11) (public member function)

http://cppreference.com		  2022.07.31	 std::mersen...ister_engine(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::mersenne_twister_engine::mersenne_twister_engine&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help