Added calls to srand().

This commit is contained in:
William McBrine
2006-02-24 02:38:21 +00:00
parent af8c7ffd9e
commit 62264f9862
3 changed files with 14 additions and 6 deletions

View File

@@ -14,7 +14,7 @@
#ifdef PDCDEBUG
const char *rcsid_newdemo =
"$Id: newdemo.c,v 1.25 2006/02/16 21:51:30 wmcbrine Exp $";
"$Id: newdemo.c,v 1.26 2006/02/24 02:38:21 wmcbrine Exp $";
#endif
int WaitForUser(void);
@@ -217,13 +217,16 @@ int main(int argc, char **argv)
{
WINDOW *win;
chtype save[80], ch;
int width, height, w, x, y, i, j;
int width, height, w, x, y, i, j, seed;
#ifdef XCURSES
Xinitscr(argc, argv);
#else
initscr();
#endif
seed = time((time_t *)0);
srand(seed);
start_color();
cbreak();
noecho();

View File

@@ -1,4 +1,4 @@
/* $Id: rain.c,v 1.5 2006/02/18 23:52:07 wmcbrine Exp $ */
/* $Id: rain.c,v 1.6 2006/02/24 02:38:21 wmcbrine Exp $ */
#include <curses.h>
#include <stdlib.h>
@@ -28,7 +28,7 @@ static int next_j(int j)
int main(int argc, char *argv[])
{
int x, y, j, r, c;
int x, y, j, r, c, seed;
static int xpos[5], ypos[5];
#ifdef XCURSES
@@ -36,6 +36,8 @@ int main(int argc, char *argv[])
#else
initscr();
#endif
seed = time((time_t *)0);
srand(seed);
if (has_colors())
{

View File

@@ -23,7 +23,7 @@ Options:
-n <n> set number of worms
-t make worms leave droppings
$Id: worm.c,v 1.9 2006/02/24 02:33:20 wmcbrine Exp $
$Id: worm.c,v 1.10 2006/02/24 02:38:21 wmcbrine Exp $
*/
#include <curses.h>
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
const struct options *op;
struct worm *w;
short **ref, *ip;
int x, y, n, h, last, bottom;
int x, y, n, h, last, bottom, seed;
for (x = 1; x < argc; x++)
{
@@ -180,6 +180,9 @@ int main(int argc, char *argv[])
#else
initscr();
#endif
seed = time((time_t *)0);
srand(seed);
noecho();
cbreak();
nonl();