Jampack
Class Rand

java.lang.Object
  extended by Jampack.Rand

public class Rand
extends java.lang.Object

The rand suite generates random objects with elements distributed randomly on [0,1] or normally with mean zero and standard deviation one.

Version:
Pre-alpha
Author:
G. W. Stewart

Constructor Summary
Rand()
           
 
Method Summary
static double nd()
          Generates a normal random double.
static double[] ndary(int n)
          Generates a one-dimensional array of normal random doubles.
static double[][] ndary(int m, int n)
          Generates a two-dimensional array of normal random doubles.
static Z nz()
          Generates a normal random complex number, i.e., a complex number whose real and imaginary parts are random.
static Z1 nz1(int n)
          Generates a normal random Z1.
static Zmat nzmat(int m, int n)
          Generates a normal random Zmat.
static void setSeed(long seed)
          Sets the seed for the random number generator.
static double ud()
          Generates a random uniform double.
static double[] udary(int n)
          Generates a one-dimensional array of uniform random doubles.
static double[][] udary(int m, int n)
          Generates a two-dimensional array of uniform random doubles.
static Z uz()
          Generates a uniform random complex number, i.e., a complex number whose real and imaginary parts are random.
static Z1 uz1(int n)
          Generates a uniform random Z1.
static Zmat uzmat(int m, int n)
          Generates a uniform random Zmat.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rand

public Rand()
Method Detail

setSeed

public static void setSeed(long seed)
Sets the seed for the random number generator.

Parameters:
seed - The seed

ud

public static double ud()
Generates a random uniform double.

Returns:
a uniform random double

udary

public static double[] udary(int n)
Generates a one-dimensional array of uniform random doubles.

Parameters:
n - The length of the array.
Returns:
The array of uniform doubles.

udary

public static double[][] udary(int m,
                               int n)
Generates a two-dimensional array of uniform random doubles.

Parameters:
m - The number of rows in the array.
n - The number of columns in the array.
Returns:
The array of uniform doubles.

uz

public static Z uz()
Generates a uniform random complex number, i.e., a complex number whose real and imaginary parts are random.

Returns:
The uniform random Z

uz1

public static Z1 uz1(int n)
              throws JampackException
Generates a uniform random Z1.

Parameters:
n - The length of the Z1
Returns:
The uniform random Z1
Throws:
JampackException - Passed from below.

uzmat

public static Zmat uzmat(int m,
                         int n)
                  throws JampackException
Generates a uniform random Zmat.

Parameters:
m - The number of rows in the Zmat
n - The number of columns in the Zmat
Returns:
The uniform random Zmat
Throws:
JampackException - Passed from below.

nd

public static double nd()
Generates a normal random double.

Returns:
a normal random double

ndary

public static double[] ndary(int n)
Generates a one-dimensional array of normal random doubles.

Parameters:
n - The length of the array.
Returns:
The array of normal doubles.

ndary

public static double[][] ndary(int m,
                               int n)
Generates a two-dimensional array of normal random doubles.

Parameters:
m - The number of rows in the array.
n - The number of columns in the array.
Returns:
The array of normal doubles.

nz

public static Z nz()
Generates a normal random complex number, i.e., a complex number whose real and imaginary parts are random.

Returns:
The normal random Z

nz1

public static Z1 nz1(int n)
              throws JampackException
Generates a normal random Z1.

Parameters:
n - The length of the Z1
Returns:
The normal random Z1
Throws:
JampackException - Passed from below.

nzmat

public static Zmat nzmat(int m,
                         int n)
                  throws JampackException
Generates a normal random Zmat.

Parameters:
m - The number of rows in the Zmat
n - The number of columns in the Zmat
Returns:
The normal random Zmat
Throws:
JampackException - Passed from below.