0. Rand = ; Random numbers the hard way.~; In1 reseed trigger, fires when In1 changes values~; In2 reseed value, grabbed when In1 changes~~; V0 the random sequence~; V1 previous In1 value so we know when it changes~~Switch( (In1-V1), 2, 1 ), ; either RSeed or RNext ~Out(V0 AND 127)~TxtLabel("Rand")~ToolTip("RNext", "RSeed (when value changes)", "Seed value")~
1. RNext = ; Random numbers the hard way.~; RNext, generate the next random number~~V0.( ( ( V0 * 4961 ) + 1 ) MOD 65536 )~
2. RSeed = ; Random numbers the hard way.~; Reseed by grabbing In2~~V1.(In1), ; store so we know when it changes~V0.(In2) ; reseed the sequence~~
3.
4.
5.
6.
7.
8.
9.
10. UpDown = ; Determine if new value is higher than the previous value~~V0.(IIF(In1>V1,In1,V0)),~Out(V0),~V1.(In1),~~TxtLabel("UpDown"),~ToolTip("Clock", "Value is stored if higher than previous")
11. DownUp = ; Determine if new value is lower than the previous value~~V0.(IIF(In1<V1,In1,V0)),~Out(V0),~V1.(In1),~~TxtLabel("DownUp"),~ToolTip("Clock", "Value is stored if lower than previous")
12. UpDownClocked = ; Determine if new value is higher than the previous value~~V0.(IIF(In1>V1,In1,0)),~Out(V0),~V1.(In1),~~TxtLabel("UpDownClocked"),~ToolTip("Clock", "Value is stored if higher than previous")