NO FRAMES

Class IloRandom

Definition file: ilconcert/ilorandom.h

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:

Constructor Summary
public IloRandom()
public IloRandom(const IloEnv, IloInt)
public IloRandom(IloRandomI *)
public IloRandom(const IloRandom &)
Method Summary
public voidend()
public IloEnvgetEnv()
public IloNumgetFloat()
public IloRandomI *getImpl()
public IloIntgetInt(IloInt)
public const char *getName()
public IloAnygetObject()
public voidreSeed(IloInt)
public voidsetName(const char *)
public voidsetObject(IloAny)
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)

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

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


getFloat

public IloNum getFloat()

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


getImpl

public IloRandomI * getImpl()

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


getInt

public IloInt getInt(IloInt n)

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


getName

public const char * getName()

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


getObject

public IloAny getObject()

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)

This member function assigns name to the invoking object.


setObject

public void setObject(IloAny object)

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