Changeset 11 for trunk


Ignore:
Timestamp:
Dec 17, 2005, 3:28:13 PM (14 years ago)
Author:
jtv
Message:

Initialize randomizer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ui_web.c

    r9 r11  
    66#include <stdlib.h>
    77#include <string.h>
     8#include <time.h>
    89#include <unistd.h>
    910
     
    3536enum { maxsize=16384 };
    3637
     38
     39static void seed_randomizer(void)
     40{
     41  srand(getpid()^time(NULL)^(unsigned long)getenv("SERVER_SOFTWARE"));
     42}
     43
     44
    3745static int read_id(const char input[], char buf[])
    3846{
     
    147155  {
    148156    /* We have parameters.  Create new game. */
    149     /* TODO: Seed randomizer! */
     157    seed_randomizer();
    150158    sprintf(id,"%*.*x",idlen,idlen,rand());
    151159    F = mines_init(rows,cols,mines);
Note: See TracChangeset for help on using the changeset viewer.