As you can see, 48 bits is not enough to properly shuffle a list of 17 elements. For one thousand element shuffle, more than a kilobyte of randomness is required.
Utter twaddle! What I see is someone adding 2 + 1/log2 * sum of the log2 of an arbitrary list and drawing a random, and wrong, conclusion.
The Knuth-Fisher-Yates shuffle only needs to be able to pick 1 from N -- that is, generate a uniform random number between 1 and N; where N is the number of elements in the array -- as proven by Donald Knuth, arguably the greatest Computer Scientist of the current era.
Discuss.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
Suck that fhit
| [reply] |
"arguably the greatest Computer Scientist of the current era. "
But they were not called the "Donald of Computer Programming", he looked up to someone else
"One of the first times I was ever asked about the title of my books was in 1966, during the last previous ACM national meeting held in Southern California. This was before any of the books were published, and I recall having lunch with a friend at the convention hotel. He knew how conceited I was, already at that time, so he asked if I was going to call my books "An Introduction to Don Knuth." I replied that, on the contrary, I was naming the books after him. His name: Art Evans. (The Art of Computer Programming, in person.)
" http://www.paulgraham.com/knuth.html https://cacm.acm.org/magazines/1974/12/11626-computer-programming-as-an-art/abstract
"Always Mount a Scratch Monkey" https://www.acme.com/jef/netgems/scratch_monkey.html
| [reply] |
... uniform random number between 1 and N; where N is the number of elements in the array ...
Correction: several such random numbers. Alternatively, one random number 1..N, where N is the number of permutations.
The shuffle algorithm needs a random number sequence of finite length. A PRNG with 48 bits of internal state can generate at most 248 different sequences (of some particular length), because it is deterministic. If there are more permutations than that, some will never be selected.
Those using GNU/Linux can take a quick glimpse at the working of the standard shuffle tool, shuf.
$ strace -s0 -e open,read shuf -o /dev/null -i 1-17
...
open("/dev/urandom", O_RDONLY) = 3
read(3, ""..., 11) = 11
...
$ strace -s0 -e open,read shuf -o /dev/null -i 1-1000
...
open("/dev/urandom", O_RDONLY) = 3
read(3, ""..., 1250) = 1250
...
Here, in order to shuffle a list of integers 1-17, shuf actually wants 11 random bytes. For 1000 elements, shuf reads 1250 bytes of /dev/urandom.
| [reply] |
Correction: several such random numbers. Alternatively, one random number 1..N, where N is the number of permutations.
Still garbage!
A PRNG with 48 bits of internal state can generate at most 248 different sequences
You really believe that? Then tell me, how is it that the 32-bit Mersenne Twister has a period of 219937 − 1?
You really don't have a clue do you. No wonder you hide in anonymity.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
Suck that fhit
| [reply] |