Timeline for JavaScript random BigInt
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 12 at 4:38 | vote | accept | Blindman67 | ||
| Jan 9 at 18:50 | answer | added | J_H | timeline score: 4 | |
| Jan 8 at 0:06 | history | edited | Sᴀᴍ Onᴇᴌᴀ♦ |
edited tags
|
|
| Nov 23, 2020 at 9:00 | history | tweeted | twitter.com/StackCodeReview/status/1330798275943952384 | ||
| Apr 29, 2020 at 8:13 | comment | added | Domino |
I haven't done research in that regard, but I wonder if using Crypto.getRandomValues() with a BigUint64Array would be more efficient for very large numbers.
|
|
| Oct 22, 2019 at 11:54 | comment | added | Blindman67 |
@wOxxOm Unfortunately BigInt math in JS is SLOW.. Using rand += BigInt(Math.floor(Math.random() * 1e15)); 40% fewer iterations and will increase performance for small ranges by 50%. Its even at 1e140 and 20% slower at 1e1500. Also tried rand += BigInt(Math.trunc(Math.random() * 1e15)); BigInt will not convert if there is a fractional component. Using the string Math.random().toString() gives 15 digits but will shorten the notation if it can eg 1e-14 so add overhead and thus nit worth it.
|
|
| Oct 21, 2019 at 18:06 | comment | added | woxxom | I'd use the entire meaningful part of Math.random - at least 15 digits are guaranteed by IEEE754 spec. | |
| Oct 19, 2019 at 11:22 | history | asked | Blindman67 | CC BY-SA 4.0 |