Numerics library

Random number generation

Header <experimental/random> synopsis

#include <random>

namespace std::experimental::inline fundamentals_v3 {

  
  template <class IntType>
  IntType randint(IntType a, IntType b);
  void reseed();
  void reseed(default_random_engine::result_type value);

} // namespace std::experimental::inline fundamentals_v3

Function template randint

A separate per-thread engine of type default_random_engine (), initialized to an unpredictable state, shall be maintained for each thread.

template<class IntType> IntType randint(IntType a, IntType b); The template argument meets the requirements for a template parameter named IntType in . ab. A random integer i, aib, produced from a thread-local instance of uniform_int_distribution<IntType> () invoked with the per-thread engine. void reseed(); void reseed(default_random_engine::result_type value); Let g be the per-thread engine. The first form sets g to an unpredictable state. The second form invokes g.seed(value). Subsequent calls to randint do not depend on values produced by g before calling reseed. reseed also resets any instances of uniform_int_distribution used by randint.