An oRandomizer Object applies the guassian distributed random number formula to the value of the object pointed to by the Output property. When the Operate property is 1, the value is randomized each Object-Loop iteration. If the Operate property is 0, the value is left unchanged. For any given successive random number the resulting value cannot be predicted.
The following examples use the oRandomizer Object.
Visual Basic Syntax
C and Java Syntax
' This program uses an
' oRandomizer Object to
' randomize and output
' the bits in an oDio16
Dim a As New oRandomizer
Dim b As New oDIO16
Sub main()
b.Direction = cvOutput
a.Output.Link(b)
Do
a.Operate.Pulse(1,1,250)
Loop
End Sub
// This program uses an
// oRandomizer Object to
// randomize and output
// the bits in an oDio16
oRandomizer a = New oRandomizer;
oDIO16 b = New oDIO16;
Void main(Void){
b.Direction = cvOutput;
a.Output.Link(b);
Do{
a.Operate.Pulse(1,1,250);
} While (1);
}
Basic Syntax
' This program uses an
' oRandomizer Object to
' randomize and output
' the bits in an oDio16
a Var oRandomizer(0,b)
b Var oDIO16(cvOutput)
Do
a.Operate.Pulse(1,1,250)
Loop
' This program creates a virtual
' circuit that uses an oRandomizer
' Object to randomize an 8-bit
' output on I/O Lines 8 - 15.
Dim R As New oRandomizer
Dim D As New oDIO8
Sub main()
R.Output.Link(D)
D.IOGroup = 1
D.Direction = cvOutput
Do
R.Operate = cvTrue
R.Operate = cvFalse
ooPIC.Delay = 50
Loop
End Sub
' This program creates a Virtual
' Circuit that uses the Clocked
' oRandomizerC Object to randomize
' a 16-bit tone every second.
Dim R As New oRandomizerC
Dim D As New oSpeaker
Sub Main()
R.Output.Link(D)
R.Clock.Input.Link(ooPIC.Hz60)
R.Operate = cvTrue
D.Operate = cvTrue
End Sub
' This program creates a Virtual
' Circuit that randomizes a 8-bit
' Value and copies that value to
' I/O lines 8-15 every 1/4 second.
Dim R As New oRandomizerO
Dim D As New oDIO8
Sub Main()
R.Operate = cvTrue
D.IOGroup = 1
D.Direction = cvOutput
Do
D = R
ooPIC.Delay = 250
Loop
End Sub
' This program creates a Virtual
' Circuit that randomizes a 8-bit
' value every second and copies
' that value to I/O lines 8-15.
Dim R As New oRandomizerOC
Dim D As New oDIO8
Sub Main()
R.ClockIn.Link(ooPIC.Hz1)
R.Operate = cvTrue
D.IOGroup = 1
D.Direction = cvOutput
Do
D = R
Loop
End Sub