jeudi 16 juillet 2020

Generating fixed random numbers

I know it's may looks wrong that i want to generate RANDOM but fixed numbers, but i want to generate something like numbers between 1 and 10 using random function, but every time i run the script it produces the same numbers.

Is this something possible or since i'm using random, it will never happens. (I know this could be achieved in c++, but i want to make it in JS)

i tried doing something like this:

console.log(Math.floor(Math.random()*(10)))

but this produce different number everytime i run the script

I'll be using these number in stress testing so i want to be sure that everytime the generated numbers are the same in-order to know where i get wrong and modify it and run again to know if it passed or not.

I'm running the script using node in terminal.

Aucun commentaire:

Enregistrer un commentaire