Mercurial > hg > early-roguelike
comparison xrogue/main.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 | 7c1cb43f346e |
children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
251:e7862a021609 | 252:3d4252fa2ed3 |
---|---|
164 | 164 |
165 if (wizard && getenv("SEED") != NULL) { | 165 if (wizard && getenv("SEED") != NULL) { |
166 seed = atoi(getenv("SEED")); | 166 seed = atoi(getenv("SEED")); |
167 } | 167 } |
168 else { | 168 else { |
169 seed = (int) time(&now) + getpid(); | 169 seed = md_random_seed(); |
170 } | 170 } |
171 if (wizard) | 171 if (wizard) |
172 printf("Hello %s, welcome to dungeon #%d\n", whoami, seed); | 172 printf("Hello %s, welcome to dungeon #%d\n", whoami, seed); |
173 else | 173 else |
174 printf("Hello %s, just a moment while I dig the dungeon...\n", whoami); | 174 printf("Hello %s, just a moment while I dig the dungeon...\n", whoami); |