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
25 lines
561 B
Java
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);
|
|
}
|
|
}
|