diff --git a/education/software development/ECE1400/C.md b/education/software development/ECE1400/C.md index 48785ee..9d12e93 100644 --- a/education/software development/ECE1400/C.md +++ b/education/software development/ECE1400/C.md @@ -111,6 +111,12 @@ If an ordinary character is included in the pattern matching string, it will be ## `rand` ```c // `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; ``` \ No newline at end of file