The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Vector::Real::Random - Generate random real vectors

SYNOPSIS

  use Math::Vector::Real qw(V);
  use Math::Vector::Real::Random;

  my $v = Math::Vector::Real->random_normal(7);
  my $v2 = $c->random_normal;

DESCRIPTION

This module extends the Math::Vector::Real package adding some methods for random generation of vectors.

Methods

The extra methods are:

Math::Vector::Real->random_in_box($dim, $size)
$v->random_in_box

When called as a class method, returns a random vector of dimension $dim contained 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.

Math::Vector::Real->random_versor($dim)

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).

SEE ALSO

Math::Vector::Real, Math::Random.

AUTHORS

Salvador Fandino, <salva@>, David Serrano.

COPYRIGHT AND LICENSE

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.