summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-04-14 16:56:07 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-04-14 16:56:07 -0700
commit28a0b44e400e2408b65b2bad9a137ec4fc21516d (patch)
treef9a27335d7cd45dd96f9be673233e6afa27f1d65
parent95ef32f1a667af567b9d3173fe456154e522dfde (diff)
modules/*: remove srand() initializations
Just rely on til_init()'s srand() ensuring things are fresh.
-rw-r--r--src/modules/meta2d/meta2d.c1
-rw-r--r--src/modules/pixbounce/pixbounce.c2
-rw-r--r--src/modules/sparkler/sparkler.c6
-rw-r--r--src/modules/spiro/spiro.c2
4 files changed, 0 insertions, 11 deletions
diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c
index ddf20f1..4e8024b 100644
--- a/src/modules/meta2d/meta2d.c
+++ b/src/modules/meta2d/meta2d.c
@@ -76,7 +76,6 @@ static void * meta2d_create_context(unsigned ticks, unsigned num_cpus, void *set
ctxt->din_a = din_new(10, 10, META2D_NUM_BALLS + 2);
ctxt->din_b = din_new(10, 10, META2D_NUM_BALLS + 2);
- srand(getpid());
ctxt->n_cpus = num_cpus;
for (int i = 0; i < META2D_NUM_BALLS; i++) {
diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c
index d016ff7..6585053 100644
--- a/src/modules/pixbounce/pixbounce.c
+++ b/src/modules/pixbounce/pixbounce.c
@@ -117,8 +117,6 @@ static void * pixbounce_create_context(unsigned ticks, unsigned num_cpus, void *
if (!ctxt)
return NULL;
- srand(time(NULL) + getpid());
-
ctxt->n_cpus = num_cpus;
ctxt->x = 0;
ctxt->y = 8;
diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c
index 272c0fd..f13954e 100644
--- a/src/modules/sparkler/sparkler.c
+++ b/src/modules/sparkler/sparkler.c
@@ -35,17 +35,11 @@ static sparkler_setup_t sparkler_default_setup;
static void * sparkler_create_context(unsigned ticks, unsigned num_cpus, void *setup)
{
- static int initialized;
sparkler_context_t *ctxt;
if (!setup)
setup = &sparkler_default_setup;
- if (!initialized) {
- srand(time(NULL) + getpid());
- initialized = 1;
- }
-
ctxt = calloc(1, sizeof(sparkler_context_t));
if (!ctxt)
return NULL;
diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c
index 20fd7f0..ddbc33d 100644
--- a/src/modules/spiro/spiro.c
+++ b/src/modules/spiro/spiro.c
@@ -38,8 +38,6 @@ static void * spiro_create_context(unsigned ticks, unsigned num_cpus, void *setu
if (!ctxt)
return NULL;
- srand(ticks + getpid());
-
ctxt->r=.25f+(rand()/(float)RAND_MAX)*.5f;
if(ctxt->r>.5f)
ctxt->r_dir=-1;
© All Rights Reserved