My program needs a random number between 0 and 1 (0, 1). Who can tell me how to do this? Thanks in advance
Richar
richard.dan@263.net
=?Utf-8?B?UmljaGFyZA==?= wrote:
> My program needs a random number between 0 and 1 (0, 1). Who can tell
> me how to do this? Thanks in advance.
C: rand
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vclib/html/_CRT_rand.asp
and some small calculation like
double random()
{
return ((double) rand()) / (double) RAND_MAX;
}
Managed C++:
declare:
static rnd = new System.Random();
and use:
rnd.NextDouble();
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpref/html/frlrfsystemrandomclassnextdoubletopic.asp

Signature
Greetings
Jochen
Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
#include <stdio.h
float number = rand() / (float) RAND_MAX
I think... didn't tried it :0)
Richard - 31 Mar 2004 02:56 GMT