Fix the DEFTRANSFORM of RANDOM for hairy integer types.
authorLutz Euler <lutz.euler@freenet.de>
Tue, 1 May 2012 13:57:03 +0000 (15:57 +0200)
committerLutz Euler <lutz.euler@freenet.de>
Tue, 1 May 2012 13:57:03 +0000 (15:57 +0200)
commit18911695a5625fc908b8c07e97d33bf54749a962
treef8c32c121b5d62548493c75a381eeea147d2e41e
parentef61e6c46ca429b84a61e90efcd7ac11261f92c7
Fix the DEFTRANSFORM of RANDOM for hairy integer types.

With integer types that are neither an interval nor a single known value
the DEFTRANSFORM used to generate an expression that had two problems:
First, it yielded very uneven distributions of random values for most
arguments to RANDOM that are not very small. Second, it used a too small
RANDOM-CHUNK under 64 bits word size thus never generating numbers
larger than (1- (EXPT 2 32)) even if RANDOM's argument was larger than
(EXPT 2 32).

Fix this by giving up the transform in these cases.

Add a new file "tests/random.pure.lisp" containing tests for this.
src/compiler/float-tran.lisp
tests/random.pure.lisp [new file with mode: 0644]