/** Creates a new random number generator using a single {@code long} seed. * @param seed the initial seed */ public RandomXS128 (long seed) { setSeed(seed); }
/** Sets the internal seed of this generator based on the given {@code long} value. * <p> * The given seed is passed twice through a hash function. This way, if the user passes a small value we avoid the short * irregular transient associated with states having a very small number of bits set. * @param seed a nonzero seed for this generator (if zero, the generator will be seeded with {@link Long#MIN_VALUE}). */ @Override public void setSeed (final long seed) { long seed0 = murmurHash3(seed == 0 ? Long.MIN_VALUE : seed); setState(seed0, murmurHash3(seed0)); }
/** This protected method is final because, contrary to the superclass, it's not used anymore by the other methods. */ @Override protected final int next (int bits) { return (int)(nextLong() & ((1L << bits) - 1)); }
/** Creates a new random number generator using two {@code long} seeds. * @param seed0 the first part of the initial seed * @param seed1 the second part of the initial seed */ public RandomXS128 (long seed0, long seed1) { setState(seed0, seed1); }
/** Adds an occludee entity of random type at a random place on the ground. * * @param dynamic If true, entity body will be dynamic (mass > 0) * @return The added entity */ private BulletEntity addRandomOccludee (boolean dynamic) { // Add occludee to world BulletEntity entity = world.add(getRandomOccludeeType(dynamic), 0, 0, 0); entity.setColor(Color.WHITE); // Random rotation float rotationY = rng.nextFloat() * 360f; // Random ground position Vector3 position = tmpV1; int maxDstX = (int)(GROUND_DIM.x * 0.49f); position.x = rng.nextInt(maxDstX) * ((rng.nextBoolean()) ? 1 : -1); position.z = rng.nextInt(maxDstX) * ((rng.nextBoolean()) ? 1 : -1); position.y = entity.boundingBox.getDimensions(tmpV2).y * 0.5f; entity.modelInstance.transform.setToRotation(Vector3.Y, rotationY).setTranslation(position); entity.body.setWorldTransform(entity.modelInstance.transform); return entity; }
public FlameMain () { super("Flame"); MathUtils.random = new RandomXS128(); particleSystem = ParticleSystem.get(); effect = new ParticleEffect(); particleSystem.add(effect); assetManager = new AssetManager(); assetManager.setErrorListener(this); assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(new InternalFileHandleResolver())); controllersData = new Array<ControllerData>(); lwjglCanvas = new LwjglCanvas(renderer = new AppRenderer()); addWindowListener(new WindowAdapter() { public void windowClosed (WindowEvent event) { //System.exit(0); Gdx.app.exit(); } }); initializeComponents(); setSize(1280, 950); setLocationRelativeTo(null); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); }
/** Creates a new random number generator using two {@code long} seeds. * @param seed0 the first part of the initial seed * @param seed1 the second part of the initial seed */ public RandomXS128 (long seed0, long seed1) { setState(seed0, seed1); }
public FlameMain () { super("Flame"); MathUtils.random = new RandomXS128(); particleSystem = ParticleSystem.get(); effect = new ParticleEffect(); particleSystem.add(effect); assetManager = new AssetManager(); assetManager.setErrorListener(this); assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(new InternalFileHandleResolver())); controllersData = new Array<ControllerData>(); lwjglCanvas = new LwjglCanvas(renderer = new AppRenderer()); addWindowListener(new WindowAdapter() { public void windowClosed (WindowEvent event) { //System.exit(0); Gdx.app.exit(); } }); initializeComponents(); setSize(1280, 950); setLocationRelativeTo(null); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); }
/** Returns a pseudo-random, uniformly distributed {@code boolean } value from this random number generator's sequence. * <p> * This implementation uses {@link #nextLong()} internally. */ @Override public boolean nextBoolean () { return (nextLong() & 1) != 0; }
/** Creates a new random number generator using a single {@code long} seed. * @param seed the initial seed */ public RandomXS128 (long seed) { setSeed(seed); }
/** Sets the internal seed of this generator based on the given {@code long} value. * <p> * The given seed is passed twice through a hash function. This way, if the user passes a small value we avoid the short * irregular transient associated with states having a very small number of bits set. * @param seed a nonzero seed for this generator (if zero, the generator will be seeded with {@link Long#MIN_VALUE}). */ @Override public void setSeed (final long seed) { long seed0 = murmurHash3(seed == 0 ? Long.MIN_VALUE : seed); setState(seed0, murmurHash3(seed0)); }
/** Creates a new random number generator using two {@code long} seeds. * @param seed0 the first part of the initial seed * @param seed1 the second part of the initial seed */ public RandomXS128 (long seed0, long seed1) { setState(seed0, seed1); }
public FlameMain () { super("Flame"); MathUtils.random = new RandomXS128(); particleSystem = ParticleSystem.get(); effect = new ParticleEffect(); particleSystem.add(effect); assetManager = new AssetManager(); assetManager.setErrorListener(this); assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(new InternalFileHandleResolver())); controllersData = new Array<ControllerData>(); lwjglCanvas = new LwjglCanvas(renderer = new AppRenderer()); addWindowListener(new WindowAdapter() { public void windowClosed (WindowEvent event) { //System.exit(0); Gdx.app.exit(); } }); initializeComponents(); setSize(1280, 950); setLocationRelativeTo(null); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); }
/** This protected method is final because, contrary to the superclass, it's not used anymore by the other methods. */ @Override protected final int next (int bits) { return (int)(nextLong() & ((1L << bits) - 1)); }
/** Creates a new random number generator. This constructor sets the seed of the random number generator to a value very likely * to be distinct from any other invocation of this constructor. * <p> * This implementation creates a {@link Random} instance to generate the initial seed. */ public RandomXS128 () { setSeed(new Random().nextLong()); }
/** Sets the internal seed of this generator based on the given {@code long} value. * <p> * The given seed is passed twice through a hash function. This way, if the user passes a small value we avoid the short * irregular transient associated with states having a very small number of bits set. * @param seed a nonzero seed for this generator (if zero, the generator will be seeded with {@link Long#MIN_VALUE}). */ @Override public void setSeed (final long seed) { long seed0 = murmurHash3(seed == 0 ? Long.MIN_VALUE : seed); setState(seed0, murmurHash3(seed0)); }
/** Creates a new random number generator using two {@code long} seeds. * @param seed0 the first part of the initial seed * @param seed1 the second part of the initial seed */ public RandomXS128 (long seed0, long seed1) { setState(seed0, seed1); }
/** Returns the next pseudo-random, uniformly distributed {@code int} value from this random number generator's sequence. * <p> * This implementation uses {@link #nextLong()} internally. */ @Override public int nextInt () { return (int)nextLong(); }
/** Creates a new random number generator. This constructor sets the seed of the random number generator to a value very likely * to be distinct from any other invocation of this constructor. * <p> * This implementation creates a {@link Random} instance to generate the initial seed. */ public RandomXS128 () { setSeed(new Random().nextLong()); }
/** Sets the internal seed of this generator based on the given {@code long} value. * <p> * The given seed is passed twice through a hash function. This way, if the user passes a small value we avoid the short * irregular transient associated with states having a very small number of bits set. * @param seed a nonzero seed for this generator (if zero, the generator will be seeded with {@link Long#MIN_VALUE}). */ @Override public void setSeed (final long seed) { long seed0 = murmurHash3(seed == 0 ? Long.MIN_VALUE : seed); setState(seed0, murmurHash3(seed0)); }