vault backup: 2024-10-07 15:08:40
This commit is contained in:
parent
bd9f9bc956
commit
2c92915be7
@ -111,6 +111,12 @@ If an ordinary character is included in the pattern matching string, it will be
|
|||||||
## `rand`
|
## `rand`
|
||||||
```c
|
```c
|
||||||
// `srand` creates a seed to use for rng
|
// `srand` creates a seed to use for rng
|
||||||
seed = srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
// `rand` generates a random integer between 0 and `RAND_MAX`
|
||||||
|
// To pick a number between a particular range, you can use the modulo
|
||||||
|
// operator.
|
||||||
|
// The below example picks a number between zero and four.
|
||||||
|
int num = rand() % 4;
|
||||||
|
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user