http://qs1969.pair.com?node_id=552201


in reply to Re: Random 1-1 mapping
in thread Random 1-1 mapping

Fixed comments. Been writing in both languages and can now write in neither.

$input is just a scalar. It has the range 0..$max. I don't see where a factorial of the count comes in.

The idea is:

shuffle(42, 10, 0) == 6 shuffle(42, 10, 1) == 1 shuffle(42, 10, 2) == 5 shuffle(42, 10, 3) == 8 shuffle(42, 10, 4) == 3 shuffle(42, 10, 5) == 4 shuffle(42, 10, 6) == 9 shuffle(42, 10, 7) == 2 shuffle(42, 10, 8) == 7 shuffle(42, 10, 9) == 0

?

-Andrew.