Hel;lo I pt astujng tp
For one thing, you're putting booleans into the number and text inputs. That means it will just report true, false, 1 or 0.
Second, you should probably make that block a reporter. That would make it neater and easier to debug.
Here's my implementation of a shuffle block:
You can get the smaller than or equal to block by right-clicking an equals block and choosing "relabel."
Do you try to get this?
yes thank you
That's close enough for jazz, but I don't think it's quite perfect, because INSERT won't put the item at the very end of the list, so I believe the first item of the original list will end up the last element of the result, unless INSERT AT RANDOM works differently from what I expect. (Yeah, I'm too lazy to do the experiment.)
The official textbook solution (e.g., in Knuth) is
I agree that it'd be nicer to make it a reporter and not clobber the original list, though.
I should probably add this to the List Utilities library next release...
as a reporter, right?
Random index means 1 to (length of list+1).
So every element has a chance to being placed in any position.
I made a visualization of index/value distribution after 3000 iterations.
So first element became "1" 508 times and "6" 526 times. Expected average 500.
Seems quite random for the intended purpose.
Good, thanks for doing the research. I stand corrected.
In a previous discussion @snapenilk came up with the word
shuffle (which is what I use) for this reporter
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.