void SetNetRandomGen_bn ( net_bn*  net,   randgen_ns*  rand,   bool_ns*  is_private )

Associates a random generator rand with Bayes net net, so that all operations on net that require randomness will use rand (unless overridden by another generator, as described in documentation for the particular function being used).

The functions affected are: GenerateRandomCase_bn, LearnCPTs_bn and EquationToTable_bn. It only affects LearnCPTs_bn when doing EM or gradient learning, but it may also slightly affect counting learning in the rare case of extremely large data sets that require stochastic overflow rounding. It affects EquationToTable_bn when it is necessary to do stochastic numerical integration over cell regions. It can also affect the inference functions, such as GetNodeBeliefs_bn or FindingsProbability_bn, but only if you have set them to do approximate inference by sampling.

After associating a random generator with a Bayes net, you can anytime call SetNetRandomGen_bn again to change the association to a new random generator, or to no random generator (by passing NULL).

If is_private is TRUE, then you are giving the net this randgen_ns for its exclusive use; you must not use it for anything else, and it will be destroyed automatically when the net is. If is_private is FALSE, then the net will use the randgen_ns, but you may use it for whatever other purposes you wish as well. It will not be destroyed automatically when the net is; you must do that with DeleteRandomGen_ns, but you must not destroy it until after the net is destroyed (or the net has been assigned a different or no randgen_ns using SetNetRandomGen_bn).

Version:

Versions 5.02 and greater have this function.

See also:

NewRandomGenerator_ns    To create a new randgen_ns.

Example:

See NewRandomGenerator_ns.