Login   Register  
PHP Classes
elePHPant
Icontem

Random Lib: Pick a random items with probability weights

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2009-02-20 (5 years ago) RSS 2.0 feedNot enough user ratingsTotal: 670 All time: 4,388 This week: 1,485Up
Version License PHP version Categories  
randomlib 1.4GNU General Public Lice...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
Age: ???
All time rank: 2562324 in United States United States
Week rank: 1735 Up203 in United States United States Up

  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
 0%Total:670All time:4,388
 This week:0This week:1,485Up
 User Comments (1)  
 
Very useful randomizing tool.
5 years ago (Erica L)
67%StarStarStarStar