Mercurial > hg > early-roguelike
comparison xrogue/state.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 | d3968e9cb98d |
comparison
equal
deleted
inserted
replaced
251:e7862a021609 | 252:3d4252fa2ed3 |
---|---|
3617 return( _unlink(file) ); | 3617 return( _unlink(file) ); |
3618 #else | 3618 #else |
3619 return(unlink(file)); | 3619 return(unlink(file)); |
3620 #endif | 3620 #endif |
3621 } | 3621 } |
3622 | |
3623 unsigned int | |
3624 md_random_seed(void) | |
3625 { | |
3626 unsigned int seed; | |
3627 seed = (unsigned int) time((time_t *) NULL); | |
3628 #ifdef _WIN32 | |
3629 seed += _getpid(); | |
3630 #else | |
3631 seed += getpid(); | |
3632 #endif | |
3633 return seed; | |
3634 } |