Re: random real number between 0 (inclusive) and 1 (inclusive)
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 04 Nov 2007 20:28:11 GMT
On Sun, 04 Nov 2007 19:35:39 -0000, "(-Peter-)"
<garfieldpbj@xxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
What I need is to generate a lot of random real numbers between 0 and
1, both inclusive (normally it's possible to generate the number
between 0(inclusive) and 1 (exclusive!!!) )
Multiply the number by 1+ulp where ulp in the smallest increment in a
double in the vicinity of 1.0
see http://mindprod.com/jgloss/ulp.html
In practice it makes so different since the odds of generating a
double bang on 1 is extremely remote.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- Follow-Ups:
- Re: random real number between 0 (inclusive) and 1 (inclusive)
- From: Dr J R Stockton
- Re: random real number between 0 (inclusive) and 1 (inclusive)
- From: Eric Sosman
- Re: random real number between 0 (inclusive) and 1 (inclusive)
- From: (-Peter-)
- Re: random real number between 0 (inclusive) and 1 (inclusive)
- References:
- random real number between 0 (inclusive) and 1 (inclusive)
- From: (-Peter-)
- random real number between 0 (inclusive) and 1 (inclusive)
- Prev by Date: Writing to Vista registry with Java
- Next by Date: Re: random real number between 0 (inclusive) and 1 (inclusive)
- Previous by thread: random real number between 0 (inclusive) and 1 (inclusive)
- Next by thread: Re: random real number between 0 (inclusive) and 1 (inclusive)
- Index(es):
Relevant Pages
|