mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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]
This commit is contained in:
@ -311,9 +311,13 @@ static frontend *new_window(HINSTANCE inst)
|
||||
int x, y;
|
||||
RECT r, sr;
|
||||
HDC hdc;
|
||||
time_t t;
|
||||
|
||||
fe = snew(frontend);
|
||||
fe->me = midend_new(fe);
|
||||
|
||||
time(&t);
|
||||
fe->me = midend_new(fe, &t, sizeof(t));
|
||||
|
||||
fe->inst = inst;
|
||||
midend_new_game(fe->me);
|
||||
midend_size(fe->me, &x, &y);
|
||||
@ -950,8 +954,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
if (!prev) {
|
||||
|
Reference in New Issue
Block a user