I want to assign randomly generated numbers in multiple object keys but when I call one key value in another key then I am getting different values but I want to get same value as my previous key how I can do that, help me please.
function randomNum() {
return {
random: () => {
return Math.floor(Math.random() * 100 + 1);
},
sameRandom: () => {
return randomNum().random();
},
};
}
I want to get same number in random() and sameRandom().