Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package edu.tfzr.nemanja;
- import java.math.BigInteger;
- public class Congruence {
- public BigInteger multiplier;
- public BigInteger modulus;
- public BigInteger seed;
- private BigInteger x; //next value
- public static int count=0;
- public Congruence(String smultiplier, String smodulus, String sseed) {
- multiplier = new BigInteger(smultiplier);
- modulus = new BigInteger(smodulus);
- seed = new BigInteger(sseed);
- x = seed;
- //System.out.println("k:" + k + " , m: " + ", s: " +s);
- }
- public BigInteger nextValue() {
- x = (multiplier.multiply(x)).mod(modulus);
- return x;
- }
- public double doubleValue() {
- return (x.doubleValue()) / (modulus.doubleValue());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement