Math.random() vs crypto.getRandomValues()Fastest: Math.random() (18.7x faster)
13,107,916 ops/sec
702,677 ops/sec
Fastest: Math.random() (830.6x faster)
1,387,567,488 ops/sec
1,670,575 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Math.random() | |
| crypto.getRandomValues() |
| Test name | Executions per second |
|---|---|
| ✓ Math.random() | 2,599,081,216 Ops/sec |
| crypto.getRandomValues() | 1,804,638 Ops/sec |