From aa9a8e8c7eecc2de77690b872931e88951622813 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 3 May 2004 09:10:52 +0000 Subject: The Windows RNG turns out to only give about 16 bits at a time. This is (a) pretty feeble, and (b) means that although Net seeds transfer between platforms and still generate the same game, there's a suspicious discrepancy in the typical seed _generated_ by each platform. I have a better RNG kicking around in this code base already, so I'll just use it. Each midend has its own random_state, which it passes to new_game_seed() as required. A handy consequence of this is that initial seed data is now passed to midend_new(), which means that new platform implementors are unlikely to forget to seed the RNG because failure to do so causes a compile error! [originally from svn r4187] --- misc.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 48088da..73b9a7b 100644 --- a/misc.c +++ b/misc.c @@ -7,23 +7,6 @@ #include "puzzles.h" -int rand_upto(int limit) -{ - unsigned long divisor = RAND_MAX / (unsigned)limit; - unsigned long max = divisor * (unsigned)limit; - unsigned long n; - - assert(limit > 0); - - do { - n = rand(); - } while (n >= max); - - n /= divisor; - - return (int)n; -} - void free_cfg(config_item *cfg) { config_item *i; -- cgit v1.1