1. Go to this page and download the library: Download edulazaro/lararand 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/ */
edulazaro / lararand example snippets
use EduLazaro\Lararand\Facades\Rand;
Rand::distinct(6, 49); // six lottery numbers, no repeats
Rand::shuffle($deck); // a real shuffle, every permutation equally likely
Rand::pick($prizes, 3); // three winners
Rand::int(1, 20); // a d20
Rand::string(12); // a code
Rand::bytes(32); // raw bytes
Rand::below(78); // 0 to 77
Rand::int(1, 6); // 1 to 6, both shuffle($items); // a permutation; keys are dropped
Rand::pick($items, 3); // three items, no item twice
Rand::one($items); // one item
Rand::float(); // 0.0 to 1.0, exclusive at the top
Rand::string(12, 'ABCDEF0123456789');
use EduLazaro\Lararand\Contracts\RandomSource;
use EduLazaro\Lararand\Randomness;
$scripted = new class implements RandomSource {
public function bytes(int $count): string { return str_repeat("\x00", $count); }
};
$this->app->instance(Randomness::class, new Randomness($scripted));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.