Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow in standard rand #112

Merged
merged 1 commit into from
Mar 22, 2015

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Feb 27, 2015

scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> fj.test.Rand.standard.choose(Int.MinValue, Int.MaxValue)
java.lang.IllegalArgumentException: bound must be positive
  at java.util.Random.nextInt(Random.java:388)
  at fj.test.Rand$4$1$1.f(Rand.java:135)
  at fj.test.Rand$4$1$1.f(Rand.java:131)
  at fj.test.Rand.choose(Rand.java:45)

```
scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> fj.test.Rand.standard.choose(Int.MinValue, Int.MaxValue)
java.lang.IllegalArgumentException: bound must be positive
  at java.util.Random.nextInt(Random.java:388)
  at fj.test.Rand$4$1$1.f(Rand.java:135)
  at fj.test.Rand$4$1$1.f(Rand.java:131)
  at fj.test.Rand.choose(Rand.java:45)
```
mperry added a commit that referenced this pull request Mar 22, 2015
@mperry mperry merged commit a917ecf into functionaljava:master Mar 22, 2015
@xuwei-k xuwei-k deleted the Rand-standard-overflow branch March 22, 2015 09:53
@mperry mperry added the bug label May 30, 2015
@mperry mperry added this to the v4.4 milestone May 30, 2015
@mperry mperry changed the title avoid overflow Fix overflow in standard rand May 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants