In many situations in Julia, you might want to extend some abstract type defined in the base language. In this recipe, we will show how you can implement a simple pseudo-random number generator extending AbstractRNG.
Implementing a custom pseudo-random number generator
Getting ready
In order to create your own pseudo-random number generator, you have to define a concrete type that is a subtype of the AbstractRNG abstract type and which implements methods for the seed!, rand, and rng_native_52 functions. In this recipe, we will show how you can achieve this.
The generator we will implement is called 64-bit Xorshift. It was proposed by George Marsaglia in the paper, Xorshift RNGs, published in the Journal...