mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
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'.
This commit is contained in:
parent
7387c231ee
commit
2af6e1351d
2 changed files with 28 additions and 15 deletions
|
@ -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);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue