[m-rev.] for review: address problems with random.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 26 15:58:52 AEST 2002


On 26-Sep-2002, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> library/random.m:
> 	Provide better documentation on how (not) to use the random number
> 	generator in the standard library.  Generators of this kind are
> 	very sensitive to the way in which they are used, and if used
> 	in a way not anticipated they can give very poor results.
> 
> 	XXX The standard library really should provide a better quality RNG.
> 	There is still a place for quick and dirty RNGs like this one,
> 	though, provided users are given adequate information about the
> 	pitfalls.
> 
> 	One of the pitfalls to avoid is that you shouldn't use mod (or rem)
> 	to reduce a number down to some desired range, you should use
> 	something like div.  We therefore provide a predicate that does
> 	this the prescribed way.  We also provide a predicate that is
> 	similar to randmax, but returns the number of distinct random
> 	numbers that can be generated instead of the maximum.
> 
> 	Fix random__permutation to avoid the above pitfall.
> 
> 	Replace some occurrences of is/2 with =/2.
> 
> NEWS:
> 	Mention the new predicate.

That one looks good to me.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list