Random::Set - Class for random set generation.
use Random::Set; my $obj = Random::Set->new(%params); my $random = $obj->get;
new(%params)
Constructor.
precision
Precision. Default value is 100.
set
Set definition. Set is array of arrays with pairs of probability and value. Default value is []. It is required. Sumary of probabilities must be 1.
get()
Get random value from set. Returns value from set.
new(): Bad set sum. Must be 1. From Class::Utils::set_params(): Unknown parameter '%s'.
use strict; use warnings; use Random::Set; # Object. my $obj = Random::Set->new( 'set' => [ [0.5, 'foo'], [0.5, 'bar'], ], ); # Get random data. my $random = $obj->get; # Print out. print $random."\n"; # Output like: # foo|bar
Class::Utils, Error::Pure.
Class for random day generation.
https://github.com/tupinek/Random-Set
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© Michal Josef Špaček 2013-2017 BSD 2-Clause License
0.06
To install Random::Set, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Random::Set
CPAN shell
perl -MCPAN -e shell install Random::Set
For more information on module installation, please visit the detailed CPAN module installation guide.