diff options
author | Guido van Rossum <guido@python.org> | 1997-04-11 20:44:04 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-04-11 20:44:04 (GMT) |
commit | 7844e38a988243b4f3d59feab0908246d37ea34c (patch) | |
tree | ba17b5c41fd0388632707e8ba3bbf41da012f6ac /Modules/rotormodule.c | |
parent | 6bf62dad9e83003a70aef4158df063697926ba7c (diff) | |
download | cpython-7844e38a988243b4f3d59feab0908246d37ea34c.zip cpython-7844e38a988243b4f3d59feab0908246d37ea34c.tar.gz cpython-7844e38a988243b4f3d59feab0908246d37ea34c.tar.bz2 |
Keep Microsoft VC happy.
Diffstat (limited to 'Modules/rotormodule.c')
-rw-r--r-- | Modules/rotormodule.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c index 6ead93c..65c1758 100644 --- a/Modules/rotormodule.c +++ b/Modules/rotormodule.c @@ -93,12 +93,12 @@ set_seed(r) } /* Return the next random number in the range [0.0 .. 1.0) */ -static float +static double r_random(r) Rotorobj *r; { int x, y, z; - float val, term; + double val, term; x = r->seed[0]; y = r->seed[1]; @@ -116,12 +116,12 @@ r_random(r) r->seed[1] = y; r->seed[2] = z; - term = (float)( - (((float)x)/(float)30269.0) + - (((float)y)/(float)30307.0) + - (((float)z)/(float)30323.0) + term = (double)( + (((double)x)/(double)30269.0) + + (((double)y)/(double)30307.0) + + (((double)z)/(double)30323.0) ); - val = term - (float)floor((double)term); + val = term - (double)floor((double)term); if (val >= 1.0) val = 0.0; @@ -134,7 +134,7 @@ r_rand(r, s) Rotorobj *r; short s; { - return (short)((short)(r_random(r) * (float)s) % s); + return (short)((short)(r_random(r) * (double)s) % s); } static void @@ -340,7 +340,7 @@ RTR_init(r) RTR_e_rotors(r); RTR_d_rotors(r); for (i = 0; i < r->rotors; i++) { - r->positions[i] = r_rand(r,r->size); + r->positions[i] = (unsigned char) r_rand(r,r->size); r->advances[i] = (1+(2*(r_rand(r,r->size/2)))); RTR_permute_rotor(r, &(r->e_rotor[(i*r->size)]), |