Timeline for Generating non-repeating random integers in a fixed range
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 17, 2014 at 3:11 | history | edited | Cary Swoveland | CC BY-SA 3.0 |
added 292 characters in body
|
Nov 17, 2014 at 2:40 | comment | added | Cary Swoveland | I used a hash because I wasn't thinking straight. Yes, an array makes more sense. | |
Nov 17, 2014 at 1:45 | comment | added | Flambino | Neat way to do the shuffling (and of course the last mod 26 can be skipped - don't know why I didn't do that). A part of me really wants this to be all-lazy, though, so generating the hash, while not too bad, is a little fly in the ointment. By the way, couldn't this also be done with a plain array instead of a hash? Or is there some reason to use a hash? With a regular array, the execution time went from ~3.1s to ~0.31s on my machine :) | |
Nov 15, 2014 at 6:46 | history | answered | Cary Swoveland | CC BY-SA 3.0 |