Math::Vector::Real::Random - Generate random real vectors
use Math::Vector::Real qw(V); use Math::Vector::Real::Random; my $v = Math::Vector::Real->random_normal(7); my $v2 = $c->random_normal;
This module extends the Math::Vector::Real package adding some methods for random generation of vectors.
The extra methods are:
- Math::Vector::Real->random_in_box($dim, $size)
When called as a class method, returns a random vector of dimension
$dimcontained inside the hypercube of the given size.
When called as an instance method, returns a random vector contained in the box defined by the given vector instance.
- Math::Vector::Real->random_in_sphere($dim, $radio)
Returns random vector inside the hyper-sphere of the given dimension and radio.
Returns a randon vector of norm 1.0.
- Math::Vector::Real->random_normal($dim, $sd)
Returns a random vector in the space of the given dimension, where each component follows a normal distribution with standard deviation
$sd(defaults to 1.0).
Salvador Fandino, <salva@>, David Serrano.
Copyright (C) 2011, 2013 by Salvador Fandiño
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.