Compare commits
2 Commits
57b837cd60
...
0870ac9352
Author | SHA1 | Date |
---|---|---|
|
0870ac9352 | |
|
cb82fc9969 |
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "schat2-clive",
|
||||
"version": "1.5.6",
|
||||
"version": "1.5.7",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "schat2-clive",
|
||||
"version": "1.5.6",
|
||||
"version": "1.5.7",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bhttp": "^1.2.8",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "schat2-clive",
|
||||
"version": "1.5.6",
|
||||
"version": "1.5.7",
|
||||
"description": "Game host for SChat 2-powered chat sites",
|
||||
"main": "src/app.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
function shuffle(unshuffled, limit = 10) {
|
||||
const shuffled = unshuffled;
|
||||
|
||||
for (let i = shuffled.length - 1; i > 0; i -= 1) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = shuffled[i];
|
||||
|
||||
shuffled[i] = shuffled[j];
|
||||
shuffled[j] = temp;
|
||||
}
|
||||
|
||||
return shuffled.slice(0, limit);
|
||||
}
|
||||
|
||||
module.exports = shuffle;
|
Loading…
Reference in New Issue