X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fsonar.c;h=c58f6aef69aedee357c8cabac933b2a3b893e117;hp=77255743adeb05e0afb982c0780cf1213a026e79;hb=4cecfc89e5e889c7232693897c06168fb378bd5c;hpb=c28aecf9fc41e3a03494bacf7279745425e2fa18 diff --git a/hacks/sonar.c b/hacks/sonar.c index 77255743..c58f6aef 100644 --- a/hacks/sonar.c +++ b/hacks/sonar.c @@ -38,7 +38,7 @@ * software for any purpose. It is provided "as is" without express or * implied warranty. * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * * Version 1.0 April 27, 1998. * - Initial version @@ -1350,8 +1350,8 @@ init_sim(void) return NULL; } sprintf(si->teamA[i].name, "%s%03d", si->teamAID, i+1); - si->teamA[i].nexttick = (int) (90.0 * random() / RAND_MAX); - si->teamA[i].nextdist = (int) (100.0 * random() / RAND_MAX); + si->teamA[i].nexttick = random() % 90; + si->teamA[i].nextdist = random() % 100; si->teamA[i].movedonsweep = -1; } @@ -1373,8 +1373,8 @@ init_sim(void) return NULL; } sprintf(si->teamB[i].name, "%s%03d", si->teamBID, i+1); - si->teamB[i].nexttick = (int) (90.0 * random() / RAND_MAX); - si->teamB[i].nextdist = (int) (100.0 * random() / RAND_MAX); + si->teamB[i].nexttick = random() % 90; + si->teamB[i].nextdist = random() % 100; si->teamB[i].movedonsweep = -1; } @@ -1524,8 +1524,8 @@ updateLocation(sim_target *t) int xdist, xtick; - xtick = (int) (3.0 * random() / RAND_MAX) - 1; - xdist = (int) (11.0 * random() / RAND_MAX) - 5; + xtick = (int) (random() % 3) - 1; + xdist = (int) (random() % 11) - 5; if (((t->nexttick + xtick) < 90) && ((t->nexttick + xtick) >= 0)) t->nexttick += xtick; else