Adding another parameter to the random(x) function (or another function seedrandom(x,y)) where you can specify the seed used to generate the random number... so that random(5,1053908) would give a random number up to 5 and would always be equal to another random(5,1053908)