A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4659/rand.device below:

[rand.device]

29 Numerics library [numerics] 29.6 Random number generation [rand] 29.6.6 Class random_­device [rand.device]

A random_­device uniform random bit generator produces nondeterministic random numbers.

If implementation limitations prevent generating nondeterministic random numbers, the implementation may employ a random number engine.

class random_device {
public:
    using result_type = unsigned int;

    static constexpr result_type min() { return numeric_limits<result_type>::min(); }
  static constexpr result_type max() { return numeric_limits<result_type>::max(); }

    explicit random_device(const string& token = implementation-defined);

    result_type operator()();

    double entropy() const noexcept;

  // no copy functions
  random_device(const random_device& ) = delete;
  void operator=(const random_device& ) = delete;
};

explicit random_device(const string& token = implementation-defined);

Effects: Constructs a random_­device nondeterministic uniform random bit generator object. The semantics and default value of the token parameter are implementation-defined.271

Throws: A value of an implementation-defined type derived from exception if the random_­device could not be initialized.

double entropy() const noexcept;

Returns: If the implementation employs a random number engine, returns 0.0. Otherwise, returns an entropy estimate272 for the random numbers returned by operator(), in the range min() to log2(max()+1).

result_type operator()();

Returns: A nondeterministic random value, uniformly distributed between min() and max(), inclusive. It is implementation-defined how these values are generated.

Throws: A value of an implementation-defined type derived from exception if a random number could not be obtained.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4