[jira] [Updated] (MATH-936) RandomDataGenerator#nextLong violates bounds

2013-03-09 Thread Thomas Neidhart (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Neidhart updated MATH-936:
-

Attachment: MATH-936.patch

We can not ensure that the resulting value of nextLong will really be uniformly 
distributed within the given bounds due to limited precision of the calculation 
(we would need to do the scaling calculation with a Dfp field for example, but 
this would be very slow).

The attached patch at least ensures that the resulting value will be strictly 
inside the given bounds.

 RandomDataGenerator#nextLong violates bounds
 

 Key: MATH-936
 URL: https://issues.apache.org/jira/browse/MATH-936
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.1
Reporter: Ralf Wiebicke
  Labels: random
 Attachments: MATH-936.patch, RandomGeneratorLongTest.java


 I attached a test.
 If the underlying RandomGenerator returns 0.0, then nextLong returns 
 Long.MIN_VALUE, although the lower bound is Long.MIN_VALUE+1.
 The javadoc of RandomGenerator#nextDouble does not clearly define, whether 
 the result includes the lower border of 0.0 or not.
 In java.util.Random it clearly defined as included: uniformly from the range 
 0.0d (inclusive) to 1.0d (exclusive). And the existence of 
 JDKRandomGenerator suggests, that RandomGenerator should have the same 
 contract.
 I tested with version 3.1.1 from mvnrepository

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (MATH-936) RandomDataGenerator#nextLong violates bounds

2013-02-18 Thread Ralf Wiebicke (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ralf Wiebicke updated MATH-936:
---

Attachment: RandomGeneratorLongTest.java

 RandomDataGenerator#nextLong violates bounds
 

 Key: MATH-936
 URL: https://issues.apache.org/jira/browse/MATH-936
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.1
Reporter: Ralf Wiebicke
  Labels: random
 Attachments: RandomGeneratorLongTest.java


 I attached a test.
 If the underlying RandomGenerator returns 0.0, then nextLong returns 
 Long.MIN_VALUE, although the lower bound is Long.MIN_VALUE+1.
 The javadoc of RandomGenerator#nextDouble does not clearly define, whether 
 the result includes the lower border of 0.0 or not.
 In java.util.Random it clearly defined as included: uniformly from the range 
 0.0d (inclusive) to 1.0d (exclusive). And the existence of 
 JDKRandomGenerator suggests, that RandomGenerator should have the same 
 contract.
 I tested with version 3.1.1 from mvnrepository

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira