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

FreeBSD Manual Pages

  
 
  

home | help
std::experimental::reseed(3)  C++ Standard Libary std::experimental::reseed(3)

NAME
       std::experimental::reseed - std::experimental::reseed

Synopsis
	  Defined in header <experimental/random>
	  void	reseed();					      (1) (li-
       brary fundamentals
									 TS
       v2)
	  void reseed( std::default_random_engine::result_type value (2)  (li-
       brary fundamentals
	  );								    TS
       v2)

	  Reseeds the  per-thread  random  number  engine  and	any  std::uni-
       form_int_distribution
	  instances used by randint.

	  1) Sets the per-thread engine	to an unpredictable state.
	  2) Seeds the per-thread engine g as if by g.seed(value).

Parameters
	  value	- value	of the new seed

	  Remarks

	  Subsequent  calls to randint do not depend on	values produced	by the
       per-thread
	  engine prior to calling reseed.

Example
       // Run this code

	#include <experimental/random>
	#include <iostream>

	int main()
	{
	    std::experimental::reseed();

	    std::cout << "Random 2-digit decimal numbers: ";

	    for	(auto i	= 0; i != 3; ++i)
		std::cout << std::experimental::randint(10, 99)	<< ' ';
	    std::cout << '\n';
	}

Possible output:
	Random 2-digit decimal numbers:	41 60 56

See also
	  randint generates a random integer in	the specified range
		  (function template)

http://cppreference.com		  2024.06.10	  std::experimental::reseed(3)

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

home | help