15#ifndef WSFRANDOMVARIABLE_HPP
16#define WSFRANDOMVARIABLE_HPP
18#include "wsf_export.h"
21#include "UtRandom.hpp"
22#include "UtScriptAccessible.hpp"
23#include "UtScriptClassDefine.hpp"
61 WsfRandomVariable(Distribution aDistribution,
double aParameter1,
double aParameter2, Constraints aConstraints);
65 Constraints aConstraints);
69 void ProcessInput(UtInput& aInput, UtInput::ValueType aValueType);
71 void DefineDistribution(Distribution aDistribution,
74 Constraints aConstraints);
108 operator double()
const {
return mValue; }
118 void SetDefaultValues();
155 void*
Create(
const UtScriptContext& aInstance)
override;
156 void*
Clone(
void* aObjectPtr)
override;
157 void Destroy(
void* aObjectPtr)
override;
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
Definition WsfRandomVariable.hpp:33
WsfVariable< double > mParameter2
Definition WsfRandomVariable.hpp:145
double GetParameterFirst() const
Definition WsfRandomVariable.hpp:83
Distribution mDistribution
The type of distribution.
Definition WsfRandomVariable.hpp:127
double operator<(double aRhs) const
Is the last draw value less than the specified value.
Definition WsfRandomVariable.hpp:102
double operator!=(double aRhs) const
Is the last drawn value not equal to the specified value.
Definition WsfRandomVariable.hpp:100
Distribution
The distribution of the resulting values.
Definition WsfRandomVariable.hpp:37
@ cUNIFORM
The random values will have a uniform distribution.
Definition WsfRandomVariable.hpp:42
@ cLOG_NORMAL
The random values will have a log-normal distribution.
Definition WsfRandomVariable.hpp:40
@ cNORMAL
The random values will have a normal distribution.
Definition WsfRandomVariable.hpp:41
@ cEXPONENTIAL
The random values will have a exponential distribution.
Definition WsfRandomVariable.hpp:39
@ cCONSTANT
The random values will always have a constant value.
Definition WsfRandomVariable.hpp:38
WsfRandomVariable()
Construct a default random variable with a uniform distribution in the range (0..1).
Definition WsfRandomVariable.cpp:132
Constraints
The constraints on the resulting values.
Definition WsfRandomVariable.hpp:47
@ cNO_CONSTRAINT
The variable values can be negative, zero or positive (subject to the distribution).
Definition WsfRandomVariable.hpp:48
@ cPOSITIVE
Value must be greater than zero.
Definition WsfRandomVariable.hpp:49
@ cNON_NEGATIVE
Value must be greater than or equal to zero.
Definition WsfRandomVariable.hpp:50
Constraints mConstraints
Constraints on the resulting values.
Definition WsfRandomVariable.hpp:130
const char * GetScriptClassName() const override
Definition WsfRandomVariable.hpp:111
double GetParameterSecond() const
Definition WsfRandomVariable.hpp:84
Constraints GetConstraints() const
Definition WsfRandomVariable.hpp:85
Distribution GetDistribution() const
Definition WsfRandomVariable.hpp:86
double mValue
The current (last drawn) value.
Definition WsfRandomVariable.hpp:133
ut::Random mRandom
A random number generator instance, for script usage.
Definition WsfRandomVariable.hpp:124
double operator==(double aRhs) const
Is the last drawn value equal to the specified value?
Definition WsfRandomVariable.hpp:98
double LastDraw() const
Return the last drawn value.
Definition WsfRandomVariable.hpp:79
WsfVariable< double > mParameter1
Definition WsfRandomVariable.hpp:139
ut::Random * mRandomPtr
A pointer to the currently used generator.
Definition WsfRandomVariable.hpp:121
Definition WsfScriptContext.hpp:71
UT_DECLARE_SCRIPT_METHOD(GetDistribution)
void * Create(const UtScriptContext &aInstance) override
Definition WsfRandomVariable.cpp:532
UT_DECLARE_SCRIPT_METHOD(GetConstraint)
UT_DECLARE_SCRIPT_METHOD(LastDraw)
UT_DECLARE_SCRIPT_METHOD(Set)
WsfScriptRandomVariableClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfRandomVariable.cpp:512
UT_DECLARE_SCRIPT_METHOD(Draw)
UT_DECLARE_SCRIPT_METHOD(GetFirstParameter)
UT_DECLARE_SCRIPT_METHOD(GetSecondParameter)
~WsfScriptRandomVariableClass() override=default
void * Clone(void *aObjectPtr) override
Definition WsfRandomVariable.cpp:538
void Destroy(void *aObjectPtr) override
Definition WsfRandomVariable.cpp:544
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfVariable.hpp:149