From 1d32cd012a24acd0dc031b768b9b06315913ded1 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 9 Oct 2015 13:47:07 -0700 Subject: [PATCH] Use rand() in gpanel examples. --- share/examples/gpanel/circle.c | 10 +++++----- share/examples/gpanel/fill.c | 12 ++++++------ share/examples/gpanel/line.c | 12 ++++++------ share/examples/gpanel/pixel.c | 8 ++++---- share/examples/gpanel/rect.c | 12 ++++++------ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/share/examples/gpanel/circle.c b/share/examples/gpanel/circle.c index 997e9d2..8d36965 100644 --- a/share/examples/gpanel/circle.c +++ b/share/examples/gpanel/circle.c @@ -18,15 +18,15 @@ int main() gpanel_clear(0, &xsize, &ysize); printf("Screen size %u x %u.\n", xsize, ysize); - srandom(time(0)); + srand(time(0)); printf("Draw random circles.\n"); printf("Press ^C to stop.\n"); for (;;) { - x = random() % xsize; - y = random() % ysize; - r = random() % ysize; - color = random(); + x = rand() % xsize; + y = rand() % ysize; + r = rand() % ysize; + color = rand() << 1; gpanel_circle(color, x, y, r); } return 0; diff --git a/share/examples/gpanel/fill.c b/share/examples/gpanel/fill.c index 678f0df..1cd0ae0 100644 --- a/share/examples/gpanel/fill.c +++ b/share/examples/gpanel/fill.c @@ -18,16 +18,16 @@ int main() gpanel_clear(0, &xsize, &ysize); printf("Screen size %u x %u.\n", xsize, ysize); - srandom(time(0)); + srand(time(0)); printf("Draw random filled rectangles.\n"); printf("Press ^C to stop.\n"); for (;;) { - x0 = random() % xsize; - y0 = random() % ysize; - x1 = random() % xsize; - y1 = random() % ysize; - color = random(); + x0 = rand() % xsize; + y0 = rand() % ysize; + x1 = rand() % xsize; + y1 = rand() % ysize; + color = rand() << 1; gpanel_fill(color, x0, y0, x1, y1); } return 0; diff --git a/share/examples/gpanel/line.c b/share/examples/gpanel/line.c index 1a87a51..5644330 100644 --- a/share/examples/gpanel/line.c +++ b/share/examples/gpanel/line.c @@ -18,16 +18,16 @@ int main() gpanel_clear(0, &xsize, &ysize); printf("Screen size %u x %u.\n", xsize, ysize); - srandom(time(0)); + srand(time(0)); printf("Draw random lines.\n"); printf("Press ^C to stop.\n"); for (;;) { - x0 = random() % xsize; - y0 = random() % ysize; - x1 = random() % xsize; - y1 = random() % ysize; - color = random(); + x0 = rand() % xsize; + y0 = rand() % ysize; + x1 = rand() % xsize; + y1 = rand() % ysize; + color = rand() << 1; gpanel_line(color, x0, y0, x1, y1); } return 0; diff --git a/share/examples/gpanel/pixel.c b/share/examples/gpanel/pixel.c index 33c5e0f..705f76e 100644 --- a/share/examples/gpanel/pixel.c +++ b/share/examples/gpanel/pixel.c @@ -18,14 +18,14 @@ int main() gpanel_clear(0, &xsize, &ysize); printf("Screen size %u x %u.\n", xsize, ysize); - srandom(time(0)); + srand(time(0)); printf("Draw random pixels.\n"); printf("Press ^C to stop.\n"); for (;;) { - x = random() % xsize; - y = random() % ysize; - color = random(); + x = rand() % xsize; + y = rand() % ysize; + color = rand() << 1; gpanel_pixel(color, x, y); } return 0; diff --git a/share/examples/gpanel/rect.c b/share/examples/gpanel/rect.c index 433e54d..351b663 100644 --- a/share/examples/gpanel/rect.c +++ b/share/examples/gpanel/rect.c @@ -18,16 +18,16 @@ int main() gpanel_clear(0, &xsize, &ysize); printf("Screen size %u x %u.\n", xsize, ysize); - srandom(time(0)); + srand(time(0)); printf("Draw random rectangles.\n"); printf("Press ^C to stop.\n"); for (;;) { - x0 = random() % xsize; - y0 = random() % ysize; - x1 = random() % xsize; - y1 = random() % ysize; - color = random(); + x0 = rand() % xsize; + y0 = rand() % ysize; + x1 = rand() % xsize; + y1 = rand() % ysize; + color = rand() << 1; gpanel_rect(color, x0, y0, x1, y1); } return 0;