Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileWriter;
- import java.io.IOException;
- import java.math.BigInteger;
- public class Generator {
- //Ниже реализован линейный конгруэнтный метод ГПСЧ
- //В качестве модуля берется большое простое число
- private int m = /*8191*/89;
- private int a = 5;
- private int c = 3;
- public int x;
- public Generator(int x) {
- this.x = x%m;
- }
- //Для избавления от закономерности с четными/нечетными числами проводится битовый сдвиг влево
- public int generate () {
- x = (a*x + c)%m;
- return x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement