UNPKG

@prelude/array

Version:

Array module.

17 lines 558 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const swap_js_1 = __importDefault(require("./swap.js")); /** In-place shuffle. */ const shuffle = (values) => { let n = values.length; while (n) { const i = Math.floor(Math.random() * n--); (0, swap_js_1.default)(values, n, i); } return values; }; exports.default = shuffle; //# sourceMappingURL=shuffle.js.map