Re: arc4random for src/games

2013-08-29 Thread Christian Weisgerber
Todd C. Miller: > Looks good but I think this idiom used in hangman: > > pos = (double) random() / (RAND_MAX + 1.0) * (double) Dict_size; > > Can be replaced with: > > pos = arc4random_uniform(Dict_size); > > so long as Dict_size <= UINT32_MAX, which should always be the case. Hmm. D

Re: arc4random for src/games

2013-08-29 Thread Todd C. Miller
Looks good but I think this idiom used in hangman: pos = (double) random() / (RAND_MAX + 1.0) * (double) Dict_size; Can be replaced with: pos = arc4random_uniform(Dict_size); so long as Dict_size <= UINT32_MAX, which should always be the case. A similar idiom is used by monop (compare

arc4random for src/games

2013-08-28 Thread Christian Weisgerber
This replaces srandomdev()+random() with calls to arc4random*() in src/games. There isn't much practical benefit to this. Consider it a style fix. I have NOT touched the games that call srandom() with a particular seed for deterministic gameplay. Index: arithmetic/arithmetic.c =