MvGulik Posted November 23, 2010 Share Posted November 23, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
wraithdu Posted March 27, 2011 Share Posted March 27, 2011 It's plain that A[N-1] _will_ be swapped and it can only be swapped once. So we're sure that A[N-1] doesn't contain the initial value stored in A[N-1] input array. The fact that this is certain goes against true [pseudo-]randomness. I wanted to comment on this since I am using the Fisher-Yates algo. I believe this part of your analysis is incorrect. There is absolutely the possibility that A[N-1] will NOT be swapped. Even in your code sample you allow for this: j = random integer with 0 ≤ j ≤ i This allows j to be equal to i which on the first pass is N-1, and so not swapping A[N-1]. Therefore there is no need for the final pass where you suggest exchanging A[N-1] again with an index 0..N-2. Link to comment Share on other sites More sharing options...
jchd Posted March 28, 2011 Share Posted March 28, 2011 (edited) You're perfectly right on this. There is no such problem with the algorithm as stated, contrary to what I said. I realized that shortly after posting but forgot to update the post at once. Then time passed by and ... pffft! Edit: post now updated. I apologize for smoking weird stuff. Edited March 28, 2011 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Tvern Posted March 28, 2011 Share Posted March 28, 2011 It's too bad McGulvik, or whatever it was removed his script though. I'm not completely sure how it worked, but I remember it turned out to work very well in tests. Link to comment Share on other sites More sharing options...
jchd Posted March 28, 2011 Share Posted March 28, 2011 No I didn't remove anything. I just stroke thru my bullshit prose and ghost rambling of mine. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Tvern Posted March 28, 2011 Share Posted March 28, 2011 No I didn't remove anything. I just stroke thru my bullshit prose and ghost rambling of mine.No I meant "iEvKI3gv9Wrkd41u" before he changed his name and emptied pretty much every one of his posts on this forum for some reason. (Also seems to use Comic Sans, just to annoy my gf)Right after I linked to my function on page 2 he posted a more effecient function that I believe swapped each index at least once. Now it's just me, talking to myself there. Link to comment Share on other sites More sharing options...
wraithdu Posted March 28, 2011 Share Posted March 28, 2011 @jchd No problem I know this was a pretty old post, but figured I'd post since I was using the algo. I did a search around the forum looking for other methods, but none was as elegant. I actually first came across it as a javascript implementation that someone 'ported' from PHP. Link to comment Share on other sites More sharing options...
jchd Posted March 28, 2011 Share Posted March 28, 2011 You know that two pairs of eyes are better than any single one. None of us are exception and I'm always happy to learn from my own mistakes, without any shame beyond "OMG what a dumbass am I". The ones claiming never being dumbasses to some extent are just liars.I picked the algorithm in Knuth's TAOCP vol 2 (Semi-numerical algorithms), 2nd ed. as algorithm P at page 139.As D. Knuth (humbly!) pointed out in a private letter (he always answers mails thru handwriten letters!), his citation of Peirce is still pending (p. 516 of above book):This branch of mathematics is the only one, I believe,in which good writers frequently get results entirely erroneous.... It may be doubted if there is a singleextensive treatise on probabilities in existencewhich does not contain solutions absolutely indefensible. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
MvGulik Posted March 28, 2011 Share Posted March 28, 2011 (edited) ... and emptied pretty much every one of his posts on this forum ...You wish. ... I did not even come close.Btw. Code was fake and tests where rigged if I remember correct.And cheers to your Girlfriend(s). Edited March 28, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now