Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random number generator

Status
Not open for further replies.

merlinv

Programmer
Jun 11, 2001
32
0
0
US
Hi,
I need a random number generator that is better than rand()

The maxnum is not large enough.

Any help here would be appreciated.

Thanks.

MerlinV
 
> I need a random number generator that is better than rand()
I know of two main applications for needing randomness.
- statistics
- cryptography

Which one do you want a random number generator for (or do you have some other purpose in mind)?
Not all generators are ideally suited to any purpose.

> The maxnum is not large enough.
So take a few bits from successive calls to rand() until you have enough bits.
Simple example:
[tt]int aBiggerRand = rand() * 100 + rand();[/tt]

--
 
I am trying to deal bridge hands with a random number generator and from what I have read the rand is not random enough

Thanks.

MerlinV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top