This PRNG forms a base component of the Fortuna PRNG as proposed by Bruce Schneier & Niels Ferguson (PRNG with input). The Generator can be used stand alone as deterministic PRNG (DRNG). It won't gather entropy on its own and provided with the same seed it will always generate the same sequence of bytes for the same underlying block cipher and hash algorithm.
generate a deterministic PRNG sequence
1 t { 2 import dcrypt.blockcipher.aes; 3 import dcrypt.digests.sha2; 4 5 FortunaGenerator!(AES, SHA256) prng; 6 prng.addSeed([0]); 7 8 ubyte[71] random; 9 prng.nextBytes(random); 10 11 assert(random == x"2fd720d5d7f93dc8371586ae8c09547095613e2cf8967206f8d16d5717cf15a53beae29b2cf9fc0443ae6c37fd1f11aefb13061415c4d5f27d876cb67a63ba592af029f0447815", 12 "Unexpected output of deterministic PRNG."); 13 14 ubyte[random.length] random2; 15 16 prng.nextBytes(random2); 17 18 assert(random != random2, "PRNG produced twice the same data!"