| Summary | Package variables | Synopsis | Description | General documentation | Methods |
| Summary | Top |
| Clair::RandomDistribution::RandomDistributionBase - base class for all distributions |
| Package variables | Top |
| No package variables defined. |
| Included modules | Top |
| Carp |
| Math::Random |
| Synopsis | Top |
| Do not try to instantiate this class - it is an abstract base providing methods and structures for creating probability distributions, drawing random values from distributions, and so on. |
| Description | Top |
| This class implements the following methods, which in general should not be overridden: - new_distribution
Base class constructor; only to be called from child classes
- draw_rand_from_dist
Draws a random integer from the distribution
- dump_distribution_array
Returns a string containing the distribution array,
useful for debugging, suitable for printing
|
| Methods | Top |
| dist_function | Description | Code |
| draw_rand_from_dist | No description | Code |
| dump_distribution_array | Description | Code |
| new_distribution | Description | Code |
| dist_function | code | next | Top |
| This is a skeleton method, which should be overridden by all children classes. |
| dump_distribution_array | code | prev | next | Top |
| This method returns a string containing the underlying distribution array representation. This is useful primarily for debugging. |
| new_distribution | code | prev | next | Top |
| This is the base class constructor. It should be called only by the constructor of a child class. It depends on the method "dist_function" having been implemented, because it uses this function to build the internal distribution representation. Parameters: dist_size => number of values in distribution (positive integer) dist_name => name of distribution (string) |
| dist_function | description | prev | next | Top |
sub dist_function
{croak "dist_function has not been implemented\n"; return;} |
| draw_rand_from_dist | description | prev | next | Top |
sub draw_rand_from_dist
{my $self = shift; my $rand_val = random_uniform (); # Rand val on interval [0,1]} |
| dump_distribution_array | description | prev | next | Top |
sub dump_distribution_array
{ my $self = shift;
my $out_str = "";
for (my $i = 0; $i <= $self->{dist_size}; $i++) {
$out_str .= "$i -> " . $self->{dist_array}->[$i] . "\n";
}
return $out_str;} |
| new_distribution | description | prev | next | Top |
sub new_distribution
{ my $class = shift;
my %params = @_;
my $dist_size = $params{dist_size}; # use local var for repeated access} |