PHP code example of endroid / priority-shuffle-random
1. Go to this page and download the library: Download endroid/priority-shuffle-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/ */
endroid / priority-shuffle-random example snippets
use Endroid\PriorityShuffleRandom;
$random = new PriorityShuffleRandom();
$random->add('A', 1);
$random->add('B', 2); // Show B two times as often as the other items
$random->add('C', 1);
$random->add('D', 1);
for ($i = 0; $i < 12; $i++) {
echo $random->next();
}
// Example output: CABDBDBACBAC