jeudi 22 novembre 2018

Can drand48() ever return 1?

The manual of drand48() says:

The drand48() and erand48() functions return non-negative, double-precision, floating-point values, uniformly distributed over the interval [0.0 , 1.0].

So just for clarification: Does this mean that 1.0 can be returned by drand48()? Or does it mean that the return value will be < 1.0?

I'm asking because in a brute force test drand48() never seems to return 1.0. It often returns 0, but never 1.0. However, for me the manual of drand48() seems to say that 1.0 is indeed a result that could come up, although I haven't been able to make drand48() return 1.0 in practice.

Anybody here who can shed some light onto this? Will the result always be less than 1.0 or can it also be equal to 1.0?




Aucun commentaire:

Enregistrer un commentaire