Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: David Lucena <yakumoklesk@ya...>  20090606 16:57:17

 El sáb, 6/6/09, Sylvester Steele <sylvestersteele@...> escribió: > De: Sylvester Steele <sylvestersteele@...> > Asunto: [Mingwusers] Generating random numbers > Para: "MinGW Users List" <mingwusers@...> > Fecha: sábado, 6 junio, 2009 2:48 > Hi, > > I need to generate a large number of random numbers. The > normal rand function that mingw supports generates numbers > only till 32767 ie it can give me at most 32767 random > numbers. I'll need random numbers in the range of say 5 > million. I have not been able to find any built in function > that does this on msdn etc. I've read on forums that > this is compiler dependent and can't be changed. I can > of course write my own routine to generate random numbers, > but before I do this I'd like to know if there is > another existing way of generating random numbers that would > fit my requirements. Any pointers would be helpful. > > A simple idea could be generating two or three random numbers and multiply them. 
From: Tuomo Latto <djv@ik...>  20090606 17:12:47

David Lucena wrote: >> I need to generate a large number of random numbers. The >> normal rand function that mingw supports generates numbers >> only till 32767 ie it can give me at most 32767 random >> numbers. I'll need random numbers in the range of say 5 >> million. I have not been able to find any built in function >> that does this on msdn etc. I've read on forums that >> this is compiler dependent and can't be changed. I can >> of course write my own routine to generate random numbers, >> but before I do this I'd like to know if there is >> another existing way of generating random numbers that would >> fit my requirements. Any pointers would be helpful. > > A simple idea could be generating two or three random numbers and multiply them. I think that would seriously warp the distribution. Bitshifting (and possibly XORing) would be better. Or you could use the bits for a mantissa and exponent of a floating point number. Which, I suppose, brings us to quality issues, etc.  Tuomo ... A chicken is an egg's way of producing more eggs 
From: Greg Chicares <gchicares@sb...>  20090606 23:00:24

On 20090606 17:11Z, Tuomo Latto wrote: > David Lucena wrote: >>> I need to generate a large number of random numbers. The >>> normal rand function that mingw supports generates numbers >>> only till 32767 ie it can give me at most 32767 random >>> numbers. I'll need random numbers in the range of say 5 >>> million. I have not been able to find any built in function >>> that does this on msdn etc. I've read on forums that >>> this is compiler dependent and can't be changed. I can >>> of course write my own routine to generate random numbers, >>> but before I do this I'd like to know if there is >>> another existing way of generating random numbers that would >>> fit my requirements. Any pointers would be helpful. >> >> A simple idea could be generating two or three random numbers and multiply them. > > I think that would seriously warp the distribution. For one extreme example of warpage, consider the distribution of the product of three random boolean valuesor the product of a thousand of them. > Which, I suppose, brings us to quality issues, etc. http://en.wikipedia.org/wiki/Pseudorandom_number_generator  Careful mathematical analysis is required to have any confidence a PRNG  generates numbers that are sufficiently "random" to suit the intended use.  [An expert] once titled an article, "The generation of random numbers is  too important to be left to chance." Fortunately, there's plenty of welltested free code available. 
Sign up for the SourceForge newsletter:
No, thanks