jfaker/src/main/java/com/github/javafaker/service/RandomService.java
Isaac Sadaqah 0bcfc26b2c Refactor unit tests and update history.md
1. Use hamcrest for testing
2. Change isNumber test to be more inclusive (negative numbers, decimal numbers, etc)
3. Break latitude and longitude range tests
4. Update history.md
2014-06-25 00:27:40 -04:00

25 lines
561 B
Java

package com.github.javafaker.service;
import org.apache.commons.lang.math.RandomUtils;
import java.util.Random;
public class RandomService {
private final Random random;
/**
* @param random If null is passed in, a default Random is assigned
*/
public RandomService(Random random) {
this.random = random != null ? random : RandomUtils.JVM_RANDOM;
}
public int nextInt(int n) {
return RandomUtils.nextInt(random, n);
}
public double nextDouble() {
return RandomUtils.nextDouble(random);
}
}