Timeline for Mechanism to get 10 pseudo-random positive numbers up to maximum from a seed (32-byte hash)?
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 23, 2018 at 0:28 | comment | added | Richie Frame | @Salda and if you want a number between 1 and 512, or some other power of 2, simply select the required amount least significant bits (9 in this case) and add 1 | |
| Jun 23, 2018 at 0:07 | comment | added | Richie Frame | @Salda if you want a number between 1 and 500, and you dont want to use mod 500, you can take the 32-bit value, multiply by 125, then divide by 1073741824, take the integer component, and add 1 [((x*125)\1073741824)+1]. This method will have no bias | |
| Jun 22, 2018 at 11:27 | vote | accept | Salda | ||
| Jun 22, 2018 at 11:27 | comment | added | Salda | I guess this is the best answer and you understood well my problem. In the end, we take 10 hashes to generate 10 numbers, so it's even simpler for me. I would tell you more details and maybe achieve even better solution, but the details are company's know-how until release, so I can't leak it. Thanks! | |
| Jun 22, 2018 at 0:42 | history | answered | Richie Frame | CC BY-SA 4.0 |