Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
JsonBoa2960323dHere is a much simpler version.
1) Make a constant for each card in a deck of playing cards. Don't be lazy, there are just 53 of those.
2) Put those constants in a python list
3) Use random.shuffle on it and print the list.
4) (Deep-)Copy the randomly shuffled list in another constant, let's call it "REFERENCE"
5) make a "while" loop shuffling the original deck of cards, again and again, until it equals the REFERENCE constant.
If it ever equals the REFERENCE constant in your lifetime, either you're immortal or you are about to be hacked because your system's entropy pool has dried up (pseudorandom numbers generator got predictable). -
Hazarth9455323dMaybe an interesting approach could be to not expect it to write out shakespeare in one long string but instead that it will eventually generate all the correct words in order even with a bunch of junk inbetween.
So you could download the works of Shakespeare, this would your reference. And then write a simple function to generate a random string of a variable length, say between 0 and 20 characters (or whatever would be the longest word in the reference)
Then in the reference look at the 1st word, and wait for it to be randomly generated, once that happens, highlight it and move to the 2nd word and repeat. Eventually your random monkeys will actually type out shakespeare in a reasonable-ish time that you can observe, even though it will still probably take years to significantly move forward. But I bet you could see it move forward a word or two every day with the shorter words -
K-ASS2584311d@Hazarth I’m gonna finish up the welcome page then just open a twitch stream and broadcast it until I die
So there’s this theory that given infinite time with infinite monkey typing, eventually they will type out the entire Shakespeare
I explained to my gf, I thought it was obvious but she said it’s not possible, and I had to emphasize that’s why it says infinite time.
Well then I thought, I’m gonna make a website where every x seconds it will type a character, and anyone on the website can also type one character every n seconds, and everyone will see the same sequence, on the side panel I will show what words those monkeys actually typed and maybe eventually, we can type out Shakespeare
But it’s also quite boring, tell me what I can do
rant