A strongly pure PRNG

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Jan 7 08:28:21 PST 2014


On 07/01/14 13:37, qznc wrote:
> I would consider this weakly pure, because the implicit parameter "this" is not
> immutable. A strongly pure PRNG cannot change internal state.

Related -- the work I've been doing on an updated std.random:
https://github.com/WebDrake/std.random2/blob/master/std/random2/generator.d

It's easy to make class-based PRNGs weakly pure and const (i.e. pure in 
everything bar perhaps some of the seed functions, const apart from seed 
functions and popFront).  I don't think it'd meed the criteria of a very strict 
functional-programming interpretation of purity, though.


More information about the Digitalmars-d mailing list