oRandomizer Object

Back to top of page Description:
A Processing Object that sets the value of another Object to a random number.
The following table lists the size and availability of the oRTC Object.
 ObjectSizeDescriptionA1A2B1B2C1
oRandomizer4 BytesSets the value of an Object to a random number.xxxxx
oRandomizerC6 BytesSets the value of an Object to a random number when clocked.xxx
oRandomizerO4 BytesGenerates a random number.xxx
oRandomizerOC6 BytesGenerates a random number when clocked.xxx
Back to top of page Operation:
 

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.

Back to top of page Property Options:
 The oRandomizer Object has 4 variants which are selected with the 2 property options: O and C.
  • O specifies that the Output property is replaced with a Value property.
  • C specifies that the object is clocked.
 Continuous
operation
Clocked
operation
Pointers for both input and output:oRandomizeroRandomizerC
Signed 8-Bit Value on output:oRandomizerOoRandomizerOC
Back to top of page Properties:

The following table lists the properties of the oRandomizer Object:

Property

Description

Operate
A value that selects whether or not the Output object is randomized
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe operation is not performed.
1cvOnThe operation is performed.
Output
A pointer to an oValue Object whose value will be randomized.
Object Class: oValuePtrO Value Range: Any oValue Object
Data Type: Pointer Default Value: Null
Availability: oRandomizer, oRandomizerC
Value
A signed 8-bit random value.
Object Class: oChar Value Range: 0 - 255
Data Type: Numeric (Read-Only) Default Value: 0
Availability: oRandomizerO, oRandomizerOC
Seed
A value that specifies a random number seed.
Object Class: oVar16 Value Range: 0 - 65535
Data Type: Numeric Default Value: 0
Result
A random One-Bit Boolean Value.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Result2
A random One-Bit Boolean Value.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Process
Clock
See Clocked Objects for detail
Object Class: oClockedOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Availability: oRandomizerC, oRandomizerOC
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Example:
The following examples use the oRandomizer Object.
Visual Basic SyntaxC 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

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oDiceProvides a random number.x
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.