I am making a program that has a bunch of embedded if statements. I need random number that are between 0 and 1. In order to get really "random" numbers, I set up the program to get the seed from the cpu time. Then, to get the number between 0 and 1 I was planning to divide by the greatest possible random number from the random() function, but I can't figure out what it is. It is somewhere in the neighborhood of 300000000 ( I just guessed to get that).

Another option--Is there a way to put a limit on how big the random() function can be?? then I would know the max.
thanks!

ok, I got the drand function working great. I doubt it is super random, but I will deal with that later. At least my numbers are in the right range now.

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.