[m-dev.] diff: random permutations

Ralph Becket rbeck at microsoft.com
Tue Jan 4 20:41:12 AEDT 2000


> 	(1) a function for computing a list of the first N integers
> and
> 	(2) a predicate for computing a random permutation of a list
> ?
> 
> I think those procedures would probably be more generally useful

I agree, although there may well be a place for predicates computing
	(3) random samples of integers in a range and
	(4) random permutations of the above.

In Jon Bentley's "More Programming Pearls", Column 13, he describes
two elegant algorithms for (3) and (4) invented by Bob Floyd.  These
algorithms do rely upon set data structures with efficient membership
tests, however.

Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list