https://github.com/sleekpanther/java-math-improved-random
https://github.com/sleekpanther/java-math-improved-random
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sleekpanther/java-math-improved-random
- Owner: SleekPanther
- Created: 2017-01-08T14:06:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-26T10:55:44.000Z (over 8 years ago)
- Last Synced: 2025-01-15T13:08:05.674Z (9 months ago)
- Language: Java
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java Random() Improved
Improvements on the `Math.random()` method allowing you to specify:
- An upper bound representing **range** (not just `doubles` between 0 & 1)
- A lower bound## Double Functions
Upper bound is always excluded
- `random()`
Returns a `double` between 0 and 1
- `random(double upperBound)`
Returns a `double` between 0 and upperBound
- `random(double lowerBound, double upperBound)
Returns a `double` between `lowerBound` and `upperBound`## Integer Functions `randInt()`
- `randInt()`
Returns an integer between 0 and `Integer.MAX_VALUE` (like `Random` class `nextInt()` )
- `randInt(int upperBound)`
Returns an integer between 0 and `upperBound`
**EXCLUDING `upperBound`**
- `randInt(int lowerBound, int upperBound)`
Returns an integer between `lowerBound` and `upperBound`
**INCLUDING `upperBound`**