Hi,
Can anyone help me please!!!
I'm new to C++ and trying to do my coursework......I want to know how to write a programme to generate random numbers uniformly distributed between 0 and 1.
Any help is much appreciated.
Thank you,

Look up the standard C functions in the C standard library, through <stdlib.h> or (in C++, through the <cstdlib> header). srand(int) is used to initially seed the generator. rand(), when subsequently called in a loop, produces pseudorandom integers in the range 0 to RAND_MAX.

Convert those integers returned from rand() to type double, and divide by RAND_MAX to get values in the range 0 to 1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.