I am shuffling an array with below algorithm,
let _sectionItems=section.items;
if (this.testType === this._testType) {
let i = 0, j = 0, temp = null;
for (i = section.items.length - 1; i > 0; i -= 1) {
j = Math.floor(Math.random() * (i + 1))
temp = section.items[i];
section.items[i] = section.items[j]
section.items[j] = temp
// this.sectionItems.push(_sectionItems);
// console.log("shuffing items:",section.items[j]);
}
}
Later the requirement change, right now I wanted to shuffle an array with a seed value. Instead of math.random(). How to get randomize an array with seed value. How to achieve that in typescript. I am using typescript because angular 4.