Skip to content

Commit

Permalink
Update random.c
Browse files Browse the repository at this point in the history
  • Loading branch information
bit101 authored Jun 6, 2020
1 parent 7677060 commit c02cb88
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ void rand_seed(int seed) {
}

void rand_seed_rand() {
// time(NULL) returns number of seconds since 1970 or whatever.
// clock() returns clock ticks since program started.
// combining the two should give a half decent random seed. good enough for purposes of this lib.
srand(time(NULL) % clock());
}

Expand Down

0 comments on commit c02cb88

Please sign in to comment.