tmp/tmpc8cbwak3/{from.md → to.md}
RENAMED
|
@@ -5,10 +5,11 @@ random numbers.
|
|
| 5 |
|
| 6 |
If implementation limitations prevent generating nondeterministic random
|
| 7 |
numbers, the implementation may employ a random number engine.
|
| 8 |
|
| 9 |
``` cpp
|
|
|
|
| 10 |
class random_device {
|
| 11 |
public:
|
| 12 |
// types
|
| 13 |
using result_type = unsigned int;
|
| 14 |
|
|
@@ -28,36 +29,39 @@ public:
|
|
| 28 |
|
| 29 |
// no copy functions
|
| 30 |
random_device(const random_device&) = delete;
|
| 31 |
void operator=(const random_device&) = delete;
|
| 32 |
};
|
|
|
|
| 33 |
```
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
explicit random_device(const string& token);
|
| 37 |
```
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
*Remarks:* The semantics of the `token` parameter and the token value
|
| 40 |
-
used by the default constructor are *implementation-defined*.
|
| 41 |
-
|
| 42 |
-
*Throws:* A value of an *implementation-defined* type derived from
|
| 43 |
-
`exception` if the `random_device` could not be initialized.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
double entropy() const noexcept;
|
| 47 |
```
|
| 48 |
|
| 49 |
*Returns:* If the implementation employs a random number engine, returns
|
| 50 |
-
0.0. Otherwise, returns an entropy estimate[^
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
result_type operator()();
|
| 55 |
```
|
| 56 |
|
| 57 |
*Returns:* A nondeterministic random value, uniformly distributed
|
| 58 |
between `min()` and `max()` (inclusive). It is *implementation-defined*
|
| 59 |
how these values are generated.
|
| 60 |
|
| 61 |
*Throws:* A value of an *implementation-defined* type derived from
|
| 62 |
-
`exception` if a random number
|
| 63 |
|
|
|
|
| 5 |
|
| 6 |
If implementation limitations prevent generating nondeterministic random
|
| 7 |
numbers, the implementation may employ a random number engine.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
+
namespace std {
|
| 11 |
class random_device {
|
| 12 |
public:
|
| 13 |
// types
|
| 14 |
using result_type = unsigned int;
|
| 15 |
|
|
|
|
| 29 |
|
| 30 |
// no copy functions
|
| 31 |
random_device(const random_device&) = delete;
|
| 32 |
void operator=(const random_device&) = delete;
|
| 33 |
};
|
| 34 |
+
}
|
| 35 |
```
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
explicit random_device(const string& token);
|
| 39 |
```
|
| 40 |
|
| 41 |
+
*Throws:* A value of an *implementation-defined* type derived from
|
| 42 |
+
`exception` if the `random_device` cannot be initialized.
|
| 43 |
+
|
| 44 |
*Remarks:* The semantics of the `token` parameter and the token value
|
| 45 |
+
used by the default constructor are *implementation-defined*.[^4]
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
double entropy() const noexcept;
|
| 49 |
```
|
| 50 |
|
| 51 |
*Returns:* If the implementation employs a random number engine, returns
|
| 52 |
+
0.0. Otherwise, returns an entropy estimate[^5]
|
| 53 |
+
|
| 54 |
+
for the random numbers returned by `operator()`, in the range `min()` to
|
| 55 |
+
log₂( `max()`+1).
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
result_type operator()();
|
| 59 |
```
|
| 60 |
|
| 61 |
*Returns:* A nondeterministic random value, uniformly distributed
|
| 62 |
between `min()` and `max()` (inclusive). It is *implementation-defined*
|
| 63 |
how these values are generated.
|
| 64 |
|
| 65 |
*Throws:* A value of an *implementation-defined* type derived from
|
| 66 |
+
`exception` if a random number cannot be obtained.
|
| 67 |
|