random.m = 714025; random.a = 4096; random.c = 150889; random.seed = (new Date()).getTime() % random.m; randomnumber = 1; function random() { random.seed = (random.seed * random.a + random.c) % random.m; return Math.round((random.seed / random.m) * 10000); // This will generate a random integer between 0 and 9999. If you // want to increase the range to between 0 and x, replace the // "10000" in the above line with "x - 1" }