January 11, 2014
On 11/01/14 15:12, Kagamin wrote:
> Only the cast breaks the type system, I go through holes. It's just a joke,
> purity and immutability are valued for their deterministic traits, so a random
> number generator is the last thing one would want to make pure or immutable.

That depends on your concept of a PRNG.  Strictly speaking it can/should consist of

    (i) an immutable state

   (ii) a pure function that takes as input the current immutable state and
        returns a new immutable state.

In practice, of course, it's almost invariably easier to implement this as a type that has mutable internal state.
1 2
Next ›   Last »