public IntelMKLRandomNumberStream(VSL.BRNG type, int seed) { RandomStream = new IntPtr(); int status = -1; status = vslNewStream(ref RandomStream, (int)type, seed); //status = vslNewStream(ref randomStream, BRNGMapper[(int)BRNG.MRG32K3A], seed); if (status != 0) { throw new Exception("Random number generation stream failed to initialise."); } }
public static IntPtr[] CreateMultithreadStreams(VSL.BRNG type, int seed, int nStreams) { IntPtr[] multithreadStreams = new IntPtr[nStreams]; for (int i = 0; i < nStreams; ++i) { int status = -1; status = vslNewStream(ref multithreadStreams[i], (int)type /*(int)BRNG.VSL_BRNG_MT199378*/, seed); if (status != 0) { throw new Exception("Random number generation stream failed to initialise."); } } return(multithreadStreams); }