NetworkSetRNG {RNetica} | R Documentation |
This function creates a new random number generator using the given seed and associates it with the network.
NetworkSetRNG(net, seed=sample.int(.Machine$integer.max,1L))
net |
An active |
seed |
An unsigned integer to be uses as the seed. |
Associating a random number generator with a Netica network has two
effects. First, if the seed is constant, then subsequent calls to
GenerateRandomCase
will create a reproducible sequence of
cases. Second, as the default random number generator Netica uses is
threadsafe, the random number generation will be slightly faster.
Returns the net
argument.
This function both creates the random number generator (see
NeticaRNG
) and associates it with the network
argument. Following the Netica API, it should be possible to separate
the two operations, but it unclear what would happen if the RNG object
was then freed (either manually or by associating it with another
network and then deleting that other network). It therefore seemed
safer to encapsulate the RNG creation process in the C code.
Russell Almond
http://norsys.com/onLineAPIManual/index.html: NewRandomGenerator_ns(), SetNetRandomGen_bn()
NeticaRNG
,
NewNeticaRNG()
, GenerateRandomCase()
sess <- NeticaSession() startSession(sess) rnet <- CreateNetwork("Random", session=sess) NetworkSetRNG(rnet, 1234469767) DeleteNetwork(rnet) stopSession(sess)