functionbinaryVariableGeneration

Binary variables random generator

Extends from Modelica.Icons.Function (Icon for functions).

Information

Function that generates a random binary variable with the input of probability p.

The input p denotes the probability of being true. Higher p indicates a higher chance of generating true.

Inputs

TypeNameDefaultDescription
RealpProbaility of 1
Integer[Modelica.Math.Random.Generators.Xorshift1024star.nState]stateInState of the random number generator

Outputs

TypeNameDefaultDescription
BooleanyRandom number
Integer[Modelica.Math.Random.Generators.Xorshift1024star.nState]stateOutNew state of the random number generator

Revisions

  • December 6, 2024, by Michael Wetter:
    Refactored implementation of random number calculations, transfering the local state of the random number generator from one call to the next.
    This is for #4069.
  • October 3, 2023, by Michael Wetter:
    Initialized localSeed.
    This is for #3549.
  • July 20, 2018, by Zhe Wang:
    First implementation.