They are independent, accoding to the stringent "DIEHARD" tests.
A uniform random number modulo 2^n can be generated easily by taking n bits out of the 32 random bits generated by BRandom():
#include <time.h> // define time()
#include "randomc.h" // define random number generator classes
#include "mersenne.cpp" // random number generator source code
int main() {
const int n = 10;
const int n_bit_mask = (1 << n) - 1;
int i, r;
TRandomMersenne rng(time(0));
for (i=0; i<100; i++) {
r = rng.BRandom() & n_bit_mask;
printf("%i\n", r);
}
}
|