Xorshift RNG

I tried to use the following code to generate random numbers but it always show me errors first is that t is not declared in this scope
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cmath>
int main()
{
static unsigned long x=123456789, y=362436069, z=521288629;

unsigned long xorshf96(void)           //period 2^96-1
unsigned long t;
    x ^= x << 16;
    x ^= x >> 5;
    x ^= x << 1;

   t = x;
   x = y;
   y = z;
   z = t ^ x ^ y;

  return z;
}
7
8
unsigned long xorshf96(void)           //period 2^96-1
unsigned long t;

You probably just forgot to remove line 7.
Topic archived. No new replies allowed.