diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2010-08-01 21:53:29 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-08-01 21:53:29 +0200 |
commit | 2af6e1351da68c09d6b50be535901a4f85a4807a (patch) | |
tree | 411689fd9d87d75e3d2144a250cb1d18565a942a /libguile/random.h | |
parent | 7387c231ee382a36a13a04c9f3b247b1667f0397 (diff) | |
download | guile-2af6e1351da68c09d6b50be535901a4f85a4807a.tar.gz |
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'.
Diffstat (limited to 'libguile/random.h')
-rw-r--r-- | libguile/random.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libguile/random.h b/libguile/random.h index 512b7d259..2f1f0f69a 100644 --- a/libguile/random.h +++ b/libguile/random.h @@ -67,6 +67,7 @@ SCM_API double scm_c_uniform01 (scm_t_rstate *); SCM_API double scm_c_normal01 (scm_t_rstate *); SCM_API double scm_c_exp1 (scm_t_rstate *); SCM_API scm_t_uint32 scm_c_random (scm_t_rstate *, scm_t_uint32 m); +SCM_API scm_t_uint64 scm_c_random64 (scm_t_rstate *state, scm_t_uint64 m); SCM_API SCM scm_c_random_bignum (scm_t_rstate *, SCM m); |