# Thread: a very large interval of rundom numbers

1. It's an integer (unless .RandInt means something different). Cast it or something, I guess.

EDIT: Couldn't you do something like this (un-debugged):

Code:
```int Rand( unsigned int UpperValue )
{
unsigned int Bound = 0;

while ( Bound < UpperValue )
{
Bound *= rand();
}

return Bound%UpperValue;
}```
then divide that by the 14 million number?

unless I'm completely missing the point again

2. In that case I guess you do need something more complicated than a simple call to rand() and perhaps the MTRand, boost's random library, or some other more advanced random number generator can help you out.

3. RandInt() will produce unsigned longs in the range specified by the machine where it is run. Usually, for 32 bit machines this means 2^32, which is more than enough for your needs.

Just as Daved suggested, The Boost library is another option.

4. Thank you very much for all of replys, you have helped me very much. I think that now I generate very well my random numbers with the algorithm that I have pasted before and therefore I will continue my project of end of career, this is one example of the numbers:

0.165794,0.0661423,0.923107,0.531084,0.34571,0.203 416,0.029796,0.230248,0.232488,0.3
13662,0.290937,0.399191,0.268811,0.0109423,0.72024 4,0.971198,0.747598,0.391661,0.841
39,0.503972,0.516979,0.889657,0.662066,0.386967,0. 165785,0.818416,0.44327,0.397976,0.
912517,0.141096,0.225495,0.417585,0.681512,0.35767 8,0.728592,0.849111,0.944788,0.713
195,0.768732,0.169899,0.330627,0.935429,0.0824016, 0.596916,0.708728,0.800829,0.50701
4,0.562885,0.424306,0.492069,0.0279898,0.905467,0. 898149,0.470343,0.368699,0.582445,0.290043,0.57629 ,0.47501,0.898634,0.645065,0.504504,0.45487,0.8500 83,0.733836,0.215999,
0.635212,0.869203,0.687654,0.901373,0.149824,0.814 778,0.396815,0.555215,0.4301,0.8225
78,0.0158782,0.53381,0.283836,0.670007,0.273425,0. 834816,0.969183,0.94561,0.607918,0.
319848,0.333663,0.350953,0.572609,0.393557,0.73656 9,0.548893,0.471629,0.249477,0.978
695,0.905908,0.197679,0.795876,0.216934,0.0718069, 0.155776,0.0472373,0.442245,0.
Thanks.

5. http://www.mathcom.com/corpdir/techi...ifaq/q210.html

Look for L'Ecuyer or Marsaglia, both have written large period random numbers and C algorithms are available online.