seedrandom-demo
v1.0.5
Published
seedrandom demo
Downloads
83
Readme
seedrandom-demo
Project setup
npm install --save seedrandom-demo
Project test
import { RandomUtil } from "../dist/index";
let seed = Date.now().toString();
let randomUtil1 = new RandomUtil({ seed, type: 0 });
let random1 = randomUtil1.random();
let randomArr1 = randomUtil1.randomArr(3);
let shuffleArr1 = randomUtil1.shuffle([1, 2, 3, 4, 5]);
console.log("randomUtil1 seed:", randomUtil1.getSeed());
console.log("randomUtil1 random value:", random1);
console.log("randomUtil1 randomArr value:", randomArr1);
console.log("randomUtil1 shuffleArr value:", shuffleArr1);
let randomUtil2 = new RandomUtil({ seed, type: 1 });
let random2 = randomUtil2.random();
let randomArr2 = randomUtil2.randomArr(3);
let shuffleArr2 = randomUtil2.shuffle([1, 2, 3, 4, 5]);
console.log("randomUtil2 seed:", randomUtil2.getSeed());
console.log("randomUtil2 random value:", random2);
console.log("randomUtil2 randomArr value:", randomArr2);
console.log("randomUtil2 shuffleArr value:", shuffleArr2);
let randomUtil3 = new RandomUtil({ seed, type: 1, min: 1, max: 100 });
let random3 = randomUtil3.random();
let randomArr3 = randomUtil3.randomArr(3);
let shuffleArr3 = randomUtil3.shuffle([1, 2, 3, 4, 5]);
console.log("randomUtil3 seed:", randomUtil3.getSeed());
console.log("randomUtil3 random value:", random3);
console.log("randomUtil3 randomArr value:", randomArr3);
console.log("randomUtil3 shuffleArr value:", shuffleArr3);