Intricate Tendencies

Ask me anything   Archive   me   puppies   

Jacky CK Chen. 23. Chinese. Libra.
HK->LA->SF. Software Developer.
Berkeley Grad '11
Reblog ALL pug posts!

nerdy post…

Work hasn’t been too challenging lately, so it’s good that I’m taking some online classes to spice things up. I forgot a lot about python already so it’s nice to be reminded of its vast usage. The unit deals w/ dealing poker hands so that’s always fun (yay math; yes stop reading if you don’t like it lol) And of course as with many things in life one would have to do with the random function, and this was stumbled upon…

random.shuffle(x[random])

Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function random().

Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence can never be generated.

which is very interesting.

This basically says that for a long ass list (http://xkcd.com/37), the space of possible permutations is much larger than what the RNG (random number generator) is capable of producing. Hence, some permutations will never appear! Is this then truly random (every permutation having an equal chance of appearing)?

More about shuffling: Everytime you shuffle a deck, it is likely that it’s never been generated before. Ever. It’s like a new born baby.

— 1 year ago with 8 notes
#personal  #work  #nerdy  #math  #programming  #python  #poker  #math  #random  #sequence  #permutation  #RNG  #PNG  #never  #xkcd  #shuffling  #shuffle  #code  #generate  #baby 
  1. jayckayc posted this