# Large random numbers

26

How could one generate large random numbers, ranging between 0 and X where X can be up to 1.500.000?

The standard random numbers generators I found are going up to 32767, not higher. And I need higher.

1647

How could one generate large random numbers, ranging between 0 and X where X can be up to 1.500.000?

The standard random numbers generators I found are going up to 32767, not higher. And I need higher.

Among many other approaches, see https://www.mql5.com/en/forum/216865#comment_5866478

160517

How could one generate large random numbers, ranging between 0 and X where X can be up to 1.500.000?

The standard random numbers generators I found are going up to 32767, not higher. And I need higher.

For a simple way to generate pseudo-random numbers you can use this :

```int m_w = 521288629;
int m_z = 362436069;

void   SetSeed(int z=0, int w=0) { if (z != 0) m_z = z; if (w != 0) m_w = w; }
double GetRand()
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
m_w = 18000 * (m_w & 65535) + (m_w >> 16);
return ((m_z << 16) + m_w + 1.0);
}
```

Make sure to call the SetSeed() from somewhere (from init is good) - something like this :

`   SetSeed(TimeLocal(),TimeLocal()*TimeCurrent());`
11680

How could one generate large random numbers, ranging between 0 and X where X can be up to 1.500.000?

The standard random numbers generators I found are going up to 32767, not higher. And I need higher.

Multiply it by 45,777764213995788445692312387463.

160517

Icham Aidibe:

Multiply it by 45,777764213995788445692312387463.

That will still generate just 32767 pseudo-random numbers - not 1.500.000