Reduce manually duplicated code in random with deftransform for random
Describe the bug
The deftransform
for random
(in
float-tran.lisp) has an
optimization for returning random integers less than 2^{32}
. However,
the function random
(in
rand-xoroshiro.lisp duplicates
this optimization.
This makes the code somewhat fragile if the deftransform
is modified
but the function isn't (and vice versa). We can make this consistent
by just doing (random arg state)
in random
. Then we are always
consistent.
This, however, depends on the compiler being able to apply the
deftransform
. Some simple testing shows that this is the case.
Reducing this duplication is useful.
Also note that rand-mt19937.lisp does exactly this.
Desktop (please complete the following information):
- OS: All