Error in rand

Started by Fanda, July 09, 2006, 10:41:58 PM

Previous topic - Next topic

Fanda

Hello all!



It seems that there is a small error in 'rand':
> (set 'N 10)
10
> (rand 3 N)
(2 0 1 1 0 2 2 2 2 0 2)
> (length (rand 3 N))
11


Length of the generated list should be 10 (= N). 'rand' keeps returning one more than is needed.



This way:

> (rand 5 0)
(4)


Also:
> (rand 5 -1)

never returns result (infinite loop).



- Fanda



PS: I am using newLISP v.8.9.0 on Win32 MinGW

Lutz

#1
Thanks Fanda, this will work again in 8.9.1



Lutz