A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.com/random_device::random_device below:

public member function

<random>

std::random_device::random_device
explicit random_device (const string& token = /* see below */ );

Construct random device

Constructs a random_device object.

If the random_device cannot be initialized, an exception derived from the standard exception class is thrown.



Parameters
token
An identifier of a system-specific source of randomness.
The default value is a valid source for the system.
For example, on some implementations for linux systems, this parameter is interpreted as a filesystem path, and has a default value of "/dev/urandom".
string is a standard instantiation of basic_string.

Example
1
2
3
4
5
6
7
8
9
10
11
12
// random_device constructor
#include <iostream>
#include <random>

int main ()
{
  std::random_device rd;

  std::cout << "Random value: " << rd() << std::endl;

  return 0;
}

Possible output:


See also
random_device::operator()
Generate random number (public member function)

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