PHP Classes

Random Lib: Pick a random items with probability weights

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 50%Total: 698 All time: 4,698 This week: 560Up
Version License PHP version Categories
randomlib 1.4GNU General Publi...4Algorithms
Description 

Author

This class can be used to pick a random item from a collection.

It can add to a collection of items that can be values of any type: strings, numbers, objects, etc.. Each item may have a probability weight.

The class can pick one or more random items from the collection. When picking multiple items it may allow repetition of the same item or assure that all the picked items are unique.

It can also pick random items considering their probability weight, so those with greater weight are more likely to be picked.

Picture of Chao Xu
Name: Chao Xu <contact>
Classes: 1 package by
Country: United States United States

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file class.random.php Class The randomlib class
Plain text file example.php Example Show a example of how it works

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:698
This week:0
All time:4,698
This week:560Up
User Ratings User Comments (1)
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:58%StarStarStar
Tests:-
Videos:-
Overall:50%StarStarStar
Rank:2635
 
Very useful randomizing tool.
15 years ago (Erica L)
67%StarStarStarStar