NO FRAMES

Class IloRandom

Definition file: ilconcert/ilorandom.h
This handle class produces streams of pseudo-random numbers.

This handle class produces streams of pseudo-random numbers. You can use objects of this class to create a search with a random element. You can create any number of instances of this class; these instances insure reproducible results in multithreaded applications, where the use of a single source for random numbers creates problems.

See Also the class IloRandomize in the ILOG Solver Reference Manual.

Constructor Summary
public IloRandom()
public IloRandom(const IloEnv env, IloInt seed=0)
public IloRandom(IloRandomI * impl)
public IloRandom(const IloRandom & rand)
Method Summary
public voidend()
public IloEnvgetEnv() const
public IloNumgetFloat() const
public IloRandomI *getImpl() const
public IloIntgetInt(IloInt n) const
public const char *getName() const
public IloAnygetObject() const
public voidreSeed(IloInt seed)
public voidsetName(const char * name) const
public voidsetObject(IloAny obj) const
Constructor Detail

IloRandom

public IloRandom()

This constructor creates a random number generator; it is initially an empty handle. You must assign this handle before you use its member functions.


IloRandom

public IloRandom(const IloEnv env, IloInt seed=0)

This constructor creates an object that generates random numbers. You can seed the generator by supplying a value for the integer argument seed.


IloRandom

public IloRandom(IloRandomI * impl)

This constructor creates a handle object (an instance of the class IloRandom) from a pointer to an implementation object (an instance of the class IloRandomI).


IloRandom

public IloRandom(const IloRandom & rand)

This constructor creates a handle object from a reference to a random number generator. After execution, both the newly constructed handle and rand point to the same implementation object.


Method Detail

end

public void end()

This member function releases all memory used by the random number generator. After a call to this member function, you should not use the generator again.


getEnv

public IloEnv getEnv() const

This member function returns the environment associated with the implementation class of the invoking generator.


getFloat

public IloNum getFloat() const

This member function returns a floating-point number drawn uniformly from the interval [0..1).


getImpl

public IloRandomI * getImpl() const

This member function returns the implementation object of the invoking handle.


getInt

public IloInt getInt(IloInt n) const

This member function returns an integer drawn uniformly from the interval [0..n).


getName

public const char * getName() const

This member function returns a character string specifying the name of the invoking object (if there is one).


getObject

public IloAny getObject() const

This member function returns the object associated with the invoking object (if there is one). Normally, an associated object contains user data pertinent to the invoking object.


reSeed

public void reSeed(IloInt seed)

This member function re-seeds the random number generator with seed.


setName

public void setName(const char * name) const

This member function assigns name to the invoking object.


setObject

public void setObject(IloAny obj) const

This member function associates obj with the invoking object. The member function getObject accesses this associated object afterward. Normally, obj contains user data pertinent to the invoking object.