tmp/tmphf9jy6fy/{from.md → to.md}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
### Low-quality random number generation <a id="c.math.rand">[[c.math.rand]]</a>
|
| 2 |
|
| 3 |
-
[*Note 1*: The header `<cstdlib>`
|
| 4 |
-
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
int rand();
|
| 8 |
void srand(unsigned int seed);
|
| 9 |
```
|
|
@@ -11,15 +11,15 @@ void srand(unsigned int seed);
|
|
| 11 |
*Effects:* The `rand` and `srand` functions have the semantics specified
|
| 12 |
in the C standard library.
|
| 13 |
|
| 14 |
*Remarks:* The implementation may specify that particular library
|
| 15 |
functions may call `rand`. It is *implementation-defined* whether the
|
| 16 |
-
`rand` function may introduce data races
|
| 17 |
|
| 18 |
[*Note 1*: The other random number generation facilities in this
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
-
ISO C 7.22.2
|
| 25 |
|
|
|
|
| 1 |
### Low-quality random number generation <a id="c.math.rand">[[c.math.rand]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: The header `<cstdlib>` declares the functions described in
|
| 4 |
+
this subclause. — *end note*]
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
int rand();
|
| 8 |
void srand(unsigned int seed);
|
| 9 |
```
|
|
|
|
| 11 |
*Effects:* The `rand` and `srand` functions have the semantics specified
|
| 12 |
in the C standard library.
|
| 13 |
|
| 14 |
*Remarks:* The implementation may specify that particular library
|
| 15 |
functions may call `rand`. It is *implementation-defined* whether the
|
| 16 |
+
`rand` function may introduce data races [[res.on.data.races]].
|
| 17 |
|
| 18 |
[*Note 1*: The other random number generation facilities in this
|
| 19 |
+
document [[rand]] are often preferable to `rand`, because `rand`’s
|
| 20 |
+
underlying algorithm is unspecified. Use of `rand` therefore continues
|
| 21 |
+
to be non-portable, with unpredictable and oft-questionable quality and
|
| 22 |
+
performance. — *end note*]
|
| 23 |
|
| 24 |
+
See also: ISO C 7.22.2
|
| 25 |
|