Re: random real number between 0 (inclusive) and 1 (inclusive)



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
.



Relevant Pages

  • Re: Issue With ArrayList
    ... Roedy Green Canadian Mind Products ... Rapidly agin'. ...
    (comp.lang.java.programmer)
  • Re: Java serialization over network
    ... Roedy Green Canadian Mind Products ... "Danish studies of 10,000 birds killed revealed that almost all died in ...
    (comp.lang.java.programmer)
  • Re: Clearing the cmd window
    ... Roedy Green Canadian Mind Products ... "The most significant trend in the US industry has been the decline in the amount ...
    (comp.lang.java.help)
  • Re: [Popupmenu]What is the use of Label and Name
    ... Roedy Green Canadian Mind Products ... "Out of 135 criminals, including robbers and rapists, 118 admitted that when they were children they burned, hanged and stabbed domestic animals." ...
    (comp.lang.java.help)
  • Re: truncating text
    ... You have two tools to fine tune the size. ... Roedy Green Canadian Mind Products ...
    (comp.lang.java.help)