in reply to Division Problem

Why are you dabbling at writing your own PRNG? This is one of those areas where "angels fear to tread." It's hard to write a good PRNG, even for experts. Commenting on the notorious rand() of the C standard library, the authors of Numerical Recipes in C (p. 276, 2nd ed.) write:

If all scientific papers whose results are in doubt because of bad rand()s were to disappear from library shelves, there would be a gap on each shelf about as big as your fist.

For your amusement, edification, and wonderment, consider Donald Knuth's Algorithm K for generating "unbelievably random numbers" (from The Art of Computer Programming. V. 2: Seminumerical Algorithms, p. 5 of 3rd Ed., 1997; my emphasis and minor edits):

Algorithm K ("Super-random" number generator). Given a 10-digit decimal number X, this algorithm may be used to change X to the number that should come next in a supposedly random sequence...

  1. [Choose number of iterations] Set Y ← floor(X/109), the most significant digit of X. (We will execute steps 2 through 13 exactly Y + 1 times; that is, we will apply randomizing transformations a random number of times.)
  2. [Choose random step.] Set Z ← floor(X/108) mod 10, the second most significant digit of X. Go to step (3 + Z) (That is, we now jump to a random step in the program.)
  3. [Ensure ≥ 5 x 109.] If X < 5000000000, set X ← X + 5000000000.
  4. [Middle square.] Replace X by floor(X2/105) mod 1010, that is, by the middle of the square of X.
  5. [Multiply.] Replace X by (1001001001 X) mod 1010.
  6. [Pseudo-complement.] If X < 100000000, then set X ← X + 9814055677; otherwise set X ← 1010 − X.
  7. [Interchange halves.] Interchange the low-order five digits of X with the high-order five digits, that is, set X ← 105 (X mod 105) + floor(X/105), the middle 10 digits of (1010 + 1) X.
  8. [Multiply.] Same as step 5.
  9. [Decrease digits.] Decrease each nonzero digit of the decimal representation of X by one.
  10. [99999 modify.] If X < 105, set X ← X2 + 99999; otherwise set X to X − 99999.
  11. [Normalize.] (At this point X cannot be zero.) If X < 109, set X ← 10X and repeat this step.
  12. [Modified middle square.] Replace X by floor(X(X − 1)/105) mod 1010, that is, by the middle 10 digits of X(X − 1).
  13. [Repeat?] If Y > 0, decrease Y by 1 and return to step 2. If Y = 0, the algorithm terminates with X as the desired "random" value.
(The machine-language program corresponding to the above algorithm was intended to be so complicated that a person reading a listing of it without explanatory comments wouldn't know what the program was doing.)

Considering all the contortions of Algorithm K, doesn't it seem plausible that it should produce almost an infinite supply of unbelievably random numbers? No! In fact, when this algorithm was first put onto a computer, it almost immediately converged to the 10-digit value 6065038420, which—by extraordinary coincidence—is transformed into itself by the algorithm. With another starting number, the sequence began to repeat after 7401 values, in a cyclic period of length 3178.

Coda: (from The Art of Computer Programming: Errata to Volume 2 (3rd edition))

Scott Fluhrer has discovered another fixed point of Algorithm K, namely the value 5008502835(!). He also found the 3-cycle 0225923640 → 2811514413 → 0590051662 → 0225923640; making a total of seven cycles in all. Exactly 128 starting numbers lead to the repeating value 5008502835; the smallest of these is 0008502835, the largest is 9944390948.

the lowliest monk