Seed based random generator
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package mc.world.generated_world;
|
||||
|
||||
public final class SeedRandomGenerator {
|
||||
|
||||
public static double random (int x, int y, int seed) {
|
||||
x = Math.abs(x - y) + 1;
|
||||
y = Math.abs(y - x) + 1;
|
||||
for (int i = 0; i < 40; i ++) {
|
||||
int a1 = x % 13;
|
||||
int a2 = x % 31;
|
||||
int a3 = x % 89;
|
||||
int a4 = y % 359;
|
||||
int a5 = y % 7;
|
||||
int a6 = y % 313;
|
||||
int a7 = y % 8461;
|
||||
int a8 = y % 105467;
|
||||
int a9 = x % 105943;
|
||||
y = x + seed;
|
||||
x += a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9;
|
||||
}
|
||||
return ((x + y) % 100000) / 100000d;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user