%export seed real sequence
        random_sequence battery_of_test_sequences dice
seed == real
real == num
sequence == [real]

random_sequence :: seed -> sequence
  random_sequence = tl . iterate transform_seed

battery_of_test_sequences :: real -> [sequence]
|| generates a battery of standard test sequences based on seeds 
|| r, 2r, 3r..... (mod 1 of course) where r is the input.
|| IMPORTANT: because of this, the input should be "irrational"
|| (in practice this means rational with a huge denominator).
  battery_of_test_sequences r
    = map random_sequence (iterate ((mod 1).(+r)) r)

dice :: num -> num -> seed -> [num]
|| min -> max -> seed -> sequence of throws
  dice min max = error "dice throws must be integers",
                  ~integer min \/ ~integer max
               = error ("no dice throws in range "++shownum min
                          ++" to "++shownum max), min>max
               = map (throw_dice min max) . random_sequence, otherwise








transform_seed :: seed -> seed
  transform_seed s = (s*257+.601373624513242634253426) mod 1

throw_dice :: num -> num -> real -> num
|| min -> max -> real value -> dice throw
|| no error checking since "dice" does all that
  throw_dice min max rnd
    = entier ((max-min+1)*rnd) + min
