diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-05-03 09:10:52 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-05-03 09:10:52 +0000 |
| commit | aa9a8e8c7eecc2de77690b872931e88951622813 (patch) | |
| tree | cfca97dbf8e19fc3e62c2f6f6689bca480f5ad21 /gtk.c | |
| parent | 6e42ddd31b5ca71f48c6260b01fc49b2451d0a56 (diff) | |
| download | puzzles-aa9a8e8c7eecc2de77690b872931e88951622813.zip puzzles-aa9a8e8c7eecc2de77690b872931e88951622813.tar.gz puzzles-aa9a8e8c7eecc2de77690b872931e88951622813.tar.bz2 puzzles-aa9a8e8c7eecc2de77690b872931e88951622813.tar.xz | |
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]
Diffstat (limited to 'gtk.c')
| -rw-r--r-- | gtk.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -688,10 +688,12 @@ static frontend *new_window(void) GtkBox *vbox; GtkWidget *menubar, *menu, *menuitem; int x, y, n; + time_t t; fe = snew(frontend); - fe->me = midend_new(fe); + time(&t); + fe->me = midend_new(fe, &t, sizeof(t)); midend_new_game(fe->me); fe->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -855,8 +857,6 @@ static frontend *new_window(void) int main(int argc, char **argv) { - srand(time(NULL)); - gtk_init(&argc, &argv); (void) new_window(); gtk_main(); |