Skip to content

Random ​

class · pocketmine\utils\Random · source

XorShift128Engine Random Number Noise, used for fast seeded values Most of the code in this class was adapted from the XorShift128Engine in the php-random library.

Constants ​

W ​

php
public const W = 88675123

X ​

php
public const X = 123456789

Y ​

php
public const Y = 362436069

Z ​

php
public const Z = 521288629

Properties ​

$seed protected ​

php
protected int $seed

Methods ​

__construct() ​

php
public function __construct(int $seed = -1)

getSeed() ​

php
public function getSeed() : int

nextBoolean() ​

php
public function nextBoolean() : bool

Returns a random boolean

nextBoundedInt() ​

php
public function nextBoundedInt(int $bound) : int

nextFloat() ​

php
public function nextFloat() : float

Returns a float between 0.0 and 1.0 (inclusive)

nextInt() ​

php
public function nextInt() : int

Returns an 31-bit integer (not signed)

nextRange() ​

php
public function nextRange(int $start = 0, int $end = 0x7fffffff) : int

Returns a random integer between $start and $end

nextSignedFloat() ​

php
public function nextSignedFloat() : float

Returns a float between -1.0 and 1.0 (inclusive)

nextSignedInt() ​

php
public function nextSignedInt() : int

Returns a 32-bit integer (signed)

setSeed() ​

php
public function setSeed(int $seed) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.