Help making pseudorandom number generator.

Could someone:
- Write a pseudorandom number generator in C++
- Number generator should have overloaded methods to allow random floats, doubles, integers ( Signed and unsigned )
- Entire thing should be in a static class ( So methods can be accessed like myRand::GetRandULong() )
-Also, it must support overloaded ranges ( Eg. random float from 0.038 to 6.428 )
If someone could code this for me it would be greatly appreciated.
Last edited on
How about you code it for yourself and we can help you along the way.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdafx.h>
#include <iostream>
using namespace std;
 
unsigned int PRNG()
{

    static unsigned int nSeed = 5323;
 
  
   nSeed = (8253729 * nSeed + 2396403);
 return nSeed  % 32767;
}
 
int main()
{
for (int nCount=0; nCount < 100; ++nCount)
    {
        cout << PRNG() << "\t";
 
    
        if ((nCount+1) % 5 == 0)
            cout << endl;
    }
}
Heres what i got so far
And if you haven't realised by my name i am a complete noob.
So i need help adding these features:
- Number generator should have overloaded methods to allow random floats, doubles, integers ( Signed and unsigned )
- Entire thing should be in a static class ( So methods can be accessed like myRand::GetRandULong() )
-Also, it must support overloaded ranges ( Eg. random float from 0.038 to 6.428 )
Last edited on
Topic archived. No new replies allowed.