Fix the range of `random' on 64-bit platforms
authorAndreas Rottmann <a.rottmann@gmx.at>
Sun, 1 Aug 2010 19:53:29 +0000 (21:53 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 1 Aug 2010 19:53:29 +0000 (21:53 +0200)
commit2af6e1351da68c09d6b50be535901a4f85a4807a
tree411689fd9d87d75e3d2144a250cb1d18565a942a
parent7387c231ee382a36a13a04c9f3b247b1667f0397
Fix the range of `random' on 64-bit platforms

For > 32 bit integers still in the fixnum range, scm_random() would
return random numbers with a lower range than specified.

* libguile/random.c (scm_i_mask32): New static inline function.
  (scm_c_random): Use `scm_i_mask32'.
  (scm_c_random64): New function, 64-bit variant of scm_c_random.
  (scm_random): Use `scm_c_random64' instead of forming the 64-bit random
  number in a bogus way.
* libguile/random.h: Added `scm_c_random64'.
libguile/random.c
libguile/random.h