Example usage for com.badlogic.gdx.math RandomXS128 RandomXS128

List of usage examples for com.badlogic.gdx.math RandomXS128 RandomXS128

Introduction

In this page you can find the example usage for com.badlogic.gdx.math RandomXS128 RandomXS128.

Prototype

public RandomXS128(long seed) 

Source Link

Document

Creates a new random number generator using a single long seed.

Usage

From source file:com.mygdx.game.world.Chunk.java

public Chunk(ArrayList<GameObject> object, int x_new, int y_new) {
    x = x_new;//from  w  ww .j  a v a  2s  .  co m
    y = y_new;

    if (x < lowest_x) {
        lowest_x = x;
    }
    if (y < lowest_y) {
        lowest_y = y;
    }

    //make unique seed:
    String str_seed = String.valueOf(World.SEED);
    String seed_x = (str_seed.substring(0, str_seed.length() / 2));
    String seed_y = (str_seed.substring(str_seed.length() / 2, str_seed.length()));
    seed_x = String.valueOf(Long.parseLong(seed_x) + x);
    seed_y = String.valueOf(Long.parseLong(seed_y) + y);

    x_seed = Long.parseLong(seed_x); //This is for the road code fx
    y_seed = Long.parseLong(seed_y); //This is for the road code also

    long seed = Long.parseLong(seed_x + seed_y);
    random_seed = new RandomXS128(seed);

    generate(object);
}