[perl] Numeros Aleatorios en perl

Ing. Roberto Andrade randrade@campus.iztacala.unam.mx
Mon, 26 Oct 1998 11:27:00 -0600 (CST)


Hola Miriam:

> Desearia saber si perl cuenta con alguna funcion para generar numeros
> aleatorios??

Extraigo de man perlfunc lo siguiente:

rand    Returns a random fractional number greater than or equal to 0
        and less than the value of EXPR.  (EXPR should be 
	positive.)  If EXPR is omitted, the value 1 is used.

srand   Sets the random number seed for the rand operator.  If EXPR is
         omitted, uses a semi-random value based on the current 
	time and process ID, among other things.  In versions of Perl
	prior to 5.004 the default seed was just the current time().  This
	isn't a particularly good seed, so many old programs supply their
	own seed value (often time ^ $$ or C<time ^ ($$ + ($$ <<
	... (sigue m'as en el man)/

Saludos,

Roberto Andrade Fonseca

--------- Pie de mensaje --------------------------------
Visite: http://tlali.iztacala.unam.mx/~randrade/perl.shtml
Cancelar inscripcion:
mail to: majordomo@tlali.iztacala.unam.mx
text   : cancelacion perl