Hello Everyone

I'm hoping smeone can help me here - I can't see the wood for the trees. I have a requirement to generate random numbers of all types, optionally between a range. I'm OK with integer and smaller numbers, in fact the code I wrote is extremely similar to the stuff on the FAQ. Where I come unstuck is generating doubles, floats and long longs between ranges as % seems to do some truncation. I have tried something like this...

r=(drand48()*(end-start+1))+start;

when end and start can be the end and start of the range, or DBL_MIN and DBL_MAX.

When I do this I don't seem to get a good spread of values, or maybe I'm just misinterpreting the output.

Can anyone enlighten me?

Many thanks in advance

tucky