Math.random vs crypto.randomUUID vs crypto.getRandomValuesFastest: Math.random (20.0x faster)
16,824,214 ops/sec
2,251,950 ops/sec
841,244 ops/sec
Fastest: Math.random (621.8x faster)
1,017,756,672 ops/sec
1,891,411 ops/sec
1,636,847 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.randomUUID | |
| crypto.getRandomValues |
| Test name | Executions per second |
|---|---|
| ✓ Math.random | 853,637,440 Ops/sec |
| crypto.getRandomValues | 1,572,916 Ops/sec |
| crypto.randomUUID | 1,352,050 Ops/sec |