Working with structs

This library makes heavy use of structs, as only structs are supported by burst (no classes). Structs and classes differ by the fact, that structs are passed by value and classes by reference. This means that structs are “copied” every time they are passed to a function and modifications in the called functions do not affect the struct in the callee.

When working with Random Number Generators the internal state must be preserved when passing the RNG to another function. Therefore RNGs always have to be passed using the ref keyword.

public static int Main() {
    var rng = new Pcg64(0xAFFE);
    DoSth(ref rng); // pass by reference!

public static int DoSth(ref Pcg64 rng) {
    // code