This is just another new Pseudo Random Number Generator based on pqRNG and it's a slightly Modification of xqRNG32.

*** Currently not undergone any statistical Test ***

The Idea behind is "porting" a mechanical Spinning Wheel Slot Machine into a simple and fast Computer based Algorithm. Please imagine a big Wheel containing 32 smaller Wheels where each of it has 256 Slots filled with numbered Gold Coins.

The functionality of the imaginary mechanical "Spin the Wheel Slot Machine" would be as follows:

#) Each Slot will be filled with 2^32 Gold Coins in a randomly Fashion.

#) A HEX-Number from 0x00 up to 0xFF is embossed on both Sides of each Coins.

#) Now we start spinning the big Wheel until it comes to hold.

#) Next we spin the small Wheel in Front of us until it comes to hold as well.

#) We draw one Gold Coin from the Slot in Front and place it on a Tray.

#) After another 3 Times repeating this Procedure we have 4 Coins with HEX-Numbers on the Tray.

#) These concatenated 4 HEX-Numbers build the 32-bit Random Value as the Result.

The C++ Listing of the imaginary "Spin the Wheel Slot Machine" will read as follows:

/* sqRNG32, Pseudo Random Number Generator based on pqRNG */
/* written by Karl-Uwe Frank, Copyright (c) 2011 Adverteam Limited (UK) */

 Free to use with or without modification and without a fee is granted
 only for private, research, academic or other non-commercial purposes.

static unsigned int seed;
static unsigned int Q, P, R;
static unsigned int X[32];
static unsigned int aP[32][256], aR[32][256];

void sqRNG32_Init() {
  Q  = seed;
  P  = 0x11B923B;
  R  = 0x6FC55;
  unsigned int tQ, tP, tR;
  int i, k;

  for (i=0; i<32; i++) {
    Q = ((Q ^ R) * P);	
    tP = Q;
    while ((tP & 0x7) != 3) tP++;
    tR = (tP >> 3);
    while ((tR & 0x7) != 5) tR++;

    X[i] = Q ^ seed;
    tQ = X[i];

    for (k=0; k<256; k++) {
      tQ = ((tQ ^ tR) * tP);
      aP[i][k] = tQ;
      while ((aP[i][k] & 0x7) != 3) aP[i][k]++;
      aR[i][k] = (aP[i][k] >> 3);
      while ((aR[i][k] & 0x7) != 5) aR[i][k]++;

unsigned int sqRNG32() {
  unsigned int Wheel;
  unsigned int Slot;
  unsigned char ByteX[4];
  int i;
  for (i=0; i<4; i++) {
    Q = ((Q ^ R) * P);
    Wheel = Q >> 27;
    Q = ((Q ^ R) * P);
    Slot = Q >> 24;
    X[Wheel] = (X[Wheel] ^ aR[Wheel][Slot]) * aP[Wheel][Slot];
    ByteX[i] = X[Wheel] >> 24;
  return (ByteX[0] << 24 | ByteX[1] << 16 | ByteX[2] << 8 | ByteX[3]);
Annotation: This PRNG should not be considered cryptographically secure.

Further Information and a documented C++ Source Code of sqRNG32 can be found at


Copyright (c) 2011 Adverteam Limited (UK), Karl-Uwe Frank
All rights reserved.