wataridori / bias-random
Random element(s) with weight
Installs: 18 085
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 4
Open Issues: 0
This package is auto-updated.
Last update: 2024-12-15 20:38:08 UTC
README
Requirement
- PHP >= 5.4
Install
You can install and manage BiasRandom by using Composer
composer require wataridori/bias-random
Or add wataridori/bias-random
into the require section of your composer.json
file then run composer update
Usage
$biasRandom = new wataridori/BiasRandom/BiasRandom(); $data = [ 'wataridori' => 10, ]; $biasRandom->setData($data); $biasRandom->addElement('Tran', 20); $biasRandom->addElement('Duc', 30); $biasRandom->addElement('Thang', 40); // Random one element with weight. $biasRandom->random(); // Random two elements $biasRandom->random(2);
Test
Just run phpunit
to start test.