Eyes Random String Generator
View Single Post
06-11-2008, 01:21 PM
Join Date: Apr 2007
I'm not really talking about optimising the code, in the sense of squeezing out that last microsecond of runtime, or saving that extra CPU cycle here and there. My main point was that much of what you wrote
to have been unnecessary for the
of the code. Case in point, the multiple calls to
From my understanding (which may be wrong!), shuffling an array multiple times doesn't make the values inside it any more randomly placed than simply shuffling once -- I'd be happy to see any tests done to determine the actual behaviour, if indeed the array is 'more random'. Because of that, I feel that shuffling more than once isn't necessary. Indeed, the entire point of shuffling the array (to randomise the values) is a non-point because the values are selected at random later using
. What's the advantage of selecting a random value from a shuffled array over selecting a random value from an ordered array? I don't see any, maybe you do.
I'll repeat, I'm not looking to optimise the code for ultimate performance but instead trying to get across the idea of good practises. There's no good point that I can think of (feel free to point any out!) as to why it's a good idea to shuffle the array once, twice, twenty times.
Take out the code block under "
shake it around abit
" and does the function perform any differently? Are the echoed/returned strings any less random?
View Public Profile
Send a private message to Salathe
Visit Salathe's homepage!
Find More Posts by Salathe