Simon Peyton-Jones:
> ... --->>> genRange,
> I think it's worth adding. The reasons not to are
>
> a) it's a change to H98, which should be strongly discouraged
>
> b) I suppose it's possible that some RNG might not know
> its own range, or the range might change --- but
> in that case I'm even less sure whether the cunning
> tricks would give statistically good results.
A generator which "does not know" its own range, is IMHO an abomination
which should be never used, with or without tricks. Well, I can see
some exceptions to this strong statement, for example Gaussian
generators
between +/- infinity, which truncate at +/- 6*sigma (the Dozen
algorithm)
or +/- log(BigNumber)*sigma (if you add some dirty nonlinear tricks),
etc. For a casual user it has most probably no importance, but *uniform*
generators without explicit range are deadly.
=====
Fergus Henderson:
> Wouldn't it be easiest if the RNG just guaranteed to
> return integers that range over the whole range of `Int'?
> Note that the range of `Int' can be obtained using the `minBound'
> and `maxBound' functions in the standard prelude.
This is a limitation, which precludes the usage of some clever
generation algorithms needing e.g. a prime modulus, or introducing
a computational overhead, most probably useless.
> * The next operation allows one to extract a pseudo-random Int
> from the generator, returning a new generator as well.
> The integer returned may be positive or negative.
> Over a sufficiently large sequence of calls to next,
> the integers returned should be uniformly distributed
> over the whole range of Int (from minBound to maxBound,
> inclusive).
>
> If that clarification were made, there would be no need to
> introduce the `genRange' method that Simon P-J suggested.
No, please, *no clarification*, but *sound and sane generators*.
Please, add range. I consider myself a real user of those beasts,
and I need it not just to speculate about.
Jerzy Karczmarczuk
Caen, France