|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
481 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = void 0;
|
|---|
| 7 | exports.shuffler = shuffler;
|
|---|
| 8 | var _default = exports.default = shuffler(Math.random);
|
|---|
| 9 | function shuffler(random) {
|
|---|
| 10 | return function shuffle(array, i0 = 0, i1 = array.length) {
|
|---|
| 11 | let m = i1 - (i0 = +i0);
|
|---|
| 12 | while (m) {
|
|---|
| 13 | const i = random() * m-- | 0,
|
|---|
| 14 | t = array[m + i0];
|
|---|
| 15 | array[m + i0] = array[i + i0];
|
|---|
| 16 | array[i + i0] = t;
|
|---|
| 17 | }
|
|---|
| 18 | return array;
|
|---|
| 19 | };
|
|---|
| 20 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.