Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SleekPanther committed Jan 8, 2017
1 parent fc3a36c commit c0e366b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MathImprovedRandom.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public static double random(double upperBound){

public static double random(double lowerBound, double upperBound){
double range = upperBound - lowerBound;
return (Math.random() * range) + lowerBound;
return (Math.random()*range) + lowerBound;
}


public static int randInt(){
return (int) (Math.random() *Integer.MAX_VALUE);
return (int) (Math.random() * Integer.MAX_VALUE); //use MAX_VALUE to simulate behavior of nextInt() from the defualt Random class
}

public static int randInt(int upperBound){
Expand All @@ -24,7 +24,7 @@ public static int randInt(int upperBound){

public static int randInt(int lowerBound, int upperBound){
int range = upperBound - lowerBound +1;
return (int) (Math.random() * range + lowerBound);
return (int) (Math.random()*range + lowerBound);
}


Expand Down

0 comments on commit c0e366b

Please # to comment.