contingent
Version:
Create cryptographically-strong random numbers in node.js or the browser
17 lines (16 loc) • 391 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function swap(list, a, b) {
const temp = list[a];
list[a] = list[b];
list[b] = temp;
return list;
}
exports.swap = swap;
function toArray(obj) {
if (obj instanceof DataView) {
return Array.from(new Uint8Array(obj.buffer));
}
return Array.from(obj);
}
exports.toArray = toArray;