Mercurial > hg > early-roguelike
comparison rogue4/new_level.c @ 252:3d4252fa2ed3
Use more portable random seed generation.
The new function md_random_seed() has replaced time() + getpid() and
similar methods. Putting everything in mdport.c slightly reduces the
warnings and workarounds.
| author | John "Elwin" Edwards |
|---|---|
| date | Sat, 28 Jan 2017 15:49:41 -0500 |
| parents | 1b73a8641b37 |
| children |
comparison
equal
deleted
inserted
replaced
| 251:e7862a021609 | 252:3d4252fa2ed3 |
|---|---|
| 71 rnd_pos(&rooms[rm], &stairs); | 71 rnd_pos(&rooms[rm], &stairs); |
| 72 index = INDEX(stairs.y, stairs.x); | 72 index = INDEX(stairs.y, stairs.x); |
| 73 if (i++ > 100) | 73 if (i++ > 100) |
| 74 { | 74 { |
| 75 i = 0; | 75 i = 0; |
| 76 srand(getpid() + (int) time((time_t *) NULL)); | 76 srand(md_random_seed()); |
| 77 } | 77 } |
| 78 } until (_level[index] == FLOOR); | 78 } until (_level[index] == FLOOR); |
| 79 _level[index] = STAIRS; | 79 _level[index] = STAIRS; |
| 80 /* | 80 /* |
| 81 * Place the traps | 81 * Place the traps |
