Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
generateRandomString
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
generateRandomString1
7116735.0 Ops/sec
Math.floor(Math.random() * 9000000000) + 1000000000
87343368.0 Ops/sec
Math.floor(Math.random() * 1000000000)
86376784.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function generateRandomString1(length) { const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let result = ''; for (let i = 0; i < length; i++) { const randomIndex = Math.floor(Math.random() * characters.length); result += characters.charAt(randomIndex); } return result; }
Tests:
generateRandomString1
generateRandomString1(8)
Math.floor(Math.random() * 9000000000) + 1000000000
Math.floor(Math.random() * 9000000000) + 1000000000
Math.floor(Math.random() * 1000000000)
Math.floor(Math.random() * 1000000000)