PHP code example of rych / random
1. Go to this page and download the library: Download rych/random library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rych / random example snippets
$random = new Rych\Random\Random();
// Generate a 16-byte string of random raw data
$randomBytes = $random->getRandomBytes(16);
// Get a random integer between 1 and 100
$randomNumber = $random->getRandomInteger(1, 100);
// Get a random 8-character string using the
// character set A-Za-z0-9./
$randomString = $random->getRandomString(8);
$encoder = new Rych\Random\Encoder\HexEncoder();
$random = new Rych\Random\Random();
$random->setEncoder($encoder);
// Generate a 16-byte string of random raw data,
// encoded as a 32-character hex string
$randomBytes = $random->getRandomBytes(16);