MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / shuffle

Function shuffle

assets/js/bucketsort.js:4–13  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

2
3// Function to randomly shuffle the array
4function shuffle(arr) {
5for (var i = arr.length - 1; i > 0; i--) {
6
7 // Generate random number
8 var j = Math.floor(Math.random() * (i + 1));
9 var temp = arr[i];
10 arr[i] = arr[j];
11 arr[j] = temp;
12}
13}
14
15function generatearray() {
16

Callers 1

generatearrayFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected