<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Random::Set - Class for random set generation.

SYNOPSIS
     use Random::Set;

     my $obj = Random::Set-&gt;new(%params);
     my $random = $obj-&gt;get;

METHODS
  "new"
     my $obj = Random::Set-&gt;new(%params);

    Constructor.

    Returns instance of object.

    *       "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"
     my $random = $obj-&gt;get;

    Get random value from set.

    Returns value from set.

ERRORS
     new():
             Bad set sum. Must be 1.
             From Class::Utils::set_params():
                     Unknown parameter '%s'.

EXAMPLE1
     use strict;
     use warnings;

     use Random::Set;

     # Object.
     my $obj = Random::Set-&gt;new(
             'set' =&gt; [
                     [0.5, 'foo'],
                     [0.5, 'bar'],
             ],
     );

     # Get random data.
     my $random = $obj-&gt;get;

     # Print out.
     print $random."\n";

     # Output like:
     # foo|bar

EXAMPLE2
     use strict;
     use warnings;

     use Random::Set;

     # Object.
     my $obj = Random::Set-&gt;new(
             'set' =&gt; [
                     [0.1, 'foo'],
                     [0.9, 'bar'],
             ],
     );

     # Get random data.
     my $random = $obj-&gt;get;

     # Print out.
     print $random."\n";

     # Output like:
     # foo (10%)|bar (90%)

DEPENDENCIES
    Class::Utils, Error::Pure.

SEE ALSO
    Random::Day
        Class for random day generation.

REPOSITORY
    &lt;https://github.com/michal-josef-spacek/Random-Set&gt;

AUTHOR
    Michal Josef Ĺ&nbsp;paÄŤek &lt;mailto:skim@cpan.org&gt;

    &lt;http://skim.cz&gt;

LICENSE AND COPYRIGHT
    Â© Michal Josef Ĺ&nbsp;paÄŤek 2013-2023

    BSD 2-Clause License

VERSION
    0.08

</pre></body></html>