Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.52 KB

random.md

File metadata and controls

39 lines (24 loc) · 1.52 KB

Generating random values

The easy way to generate something random.

The generation of random numbers is based on the php function random_int. Depending on the operating system, the php interpreter will call the C function, for example getrandom.

By default, getrandom() draws entropy from the /dev/urandom pool. In Unix-like operating systems, /dev/random, /dev/urandom and /dev/arandom are special files that serve as pseudorandom number generators.

For a more detailed understanding of the RNG, study Intel® Digital Random Number Generator (DRNG) Software Implementation Guide.

Example:

use Gambling\Tech\Random;

Random::getBytes(16); // 3ö1\x18&U\x0Fµòð$ä&ã\x05\x06

Random::getInteger(0, 100); // 7

Random::getBoolean(); // false

Random::getFloat(); // 0.57746288525196

Random::getString(16); // 3Q989ujqa3CAZl0c

Implementation in file Random.php


Algorithms | Go back