samedi 12 décembre 2015

Javascript repeatable random number based on multiple inputs

I am trying to create a function that takes 4 parameters and spits out a random number. But I want it so if the same 4 parameters are input, you will always get the same answer. The number should be between 0 and the max argument.

function random (x,y,z,max) {
    output = ;
    return Math.floor(output * max); 
}

Is there any simple forumala I can use to get this? I tried to create one but it didn't look random at all, and would look very similar if you changed one parameter very slightly. I want it to be completely different, but repeatable.




Aucun commentaire:

Enregistrer un commentaire