So i have this code but somehow console.log doesnt work, I cant tell if its bugged or just loading because it uses alot of memory and doesn't show any errors Here's the code:
function deterministicRandom(seed) {
let x = Math.sin(seed) * 10000;
return x - Math.floor(x);
}
const seed = 1234; // Your desired seed value
const test = {};
for (let i = 32; i <= 126; i++) {
const char = String.fromCharCode(i);
let randomNum = Math.floor(deterministicRandom(seed + i) * 100000) + 1;
while (Object.values(test).includes(randomNum)) {
randomNum = Math.floor(deterministicRandom(randomNum) * 100000) + 1;
}
test[char] = randomNum;
for (let j = 32; j <= 126; j++) {
const doubleChar = char + String.fromCharCode(j);
let doubleRandomNum = Math.floor(deterministicRandom(seed + i + j) * 100000) + 1;
while (Object.values(test).includes(doubleRandomNum)) {
doubleRandomNum = Math.floor(deterministicRandom(doubleRandomNum) * 100000) + 1;
}
test[doubleChar] = doubleRandomNum;
}
}
console.log(JSON.stringify(test{1}));
I tried things to debug it but i dont even know if its a bug or just loading because after 5 minutes, no results