Script Preparation code:
Tests:

Historical Performance Data aggregated from 45 community runs

Desktop Results:
Chrome 35 runs
Math.random
16.8M/s
crypto.getRandomValues
2.3M/s
crypto.randomUUID
841K/s

Fastest: Math.random (20.0x faster)

View exact numbers
  • Math.random: 16,824,214 ops/sec
  • crypto.getRandomValues: 2,251,950 ops/sec
  • crypto.randomUUID: 841,244 ops/sec
Firefox 10 runs
Math.random
1017.8M/s
crypto.randomUUID
1.9M/s
crypto.getRandomValues
1.6M/s

Fastest: Math.random (621.8x faster)

View exact numbers
  • Math.random: 1,017,756,672 ops/sec
  • crypto.randomUUID: 1,891,411 ops/sec
  • crypto.getRandomValues: 1,636,847 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Math.random
    crypto.randomUUID
    crypto.getRandomValues

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0
Firefox 146 on Mac OS X 10.15
View result in a separate tab
Math.random
853.6M/s
crypto.getRandomValues
1.6M/s
crypto.randomUUID
1.4M/s
View exact numbers
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