Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array Shuffling
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
sort randomly
4734545.5 Ops/sec
shuffle func
10567633.0 Ops/sec
Script Preparation code:
var array = ['kruze', 'medspoke', 'pickfood','listNride', 'herokey'] function shuffleArray (array) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)) const temp = array[i] array[i] = array[j] array[j] = temp } return array }
Tests:
sort randomly
array.sort(() => Math.random() - Math.random())
shuffle func
shuffleArray(array);