hi random number generation

If you have indirect addressing make a table of time bases (random) and step through it with indirect addresses moving the integer contents to the preset of the timer.

use the plc clock if you have one and add some number to it then use that number for your random number. that should be pretty random.
 
Yes, do like PLC Kid said. Here is an example that used the S:4 word of the internal Allen-Bradley RSLogix clock. The Masked Move (MVM) instruction allows you to select the range of the random number by setting the Mask value. This is a subroutine from a past student game program developed here on PLCS.net. Each time the subroutine is called, a new pseudo-random number is generated. The Equal instruction prevents getting the same number twice in a row.

attachment.php
http://www.plctalk.net/qanda/attachment.php?attachmentid=10623&stc=1&d=1244000581

Random Number Generator.jpg
 

Attachments

  • SIMPLE SIMON P4.pdf
    123.9 KB · Views: 22
Last edited:

Similar Topics

My father found a old traffic light that he wants to have in the basement. (We're car people... don't ask) What I want to do is write a program...
Replies
9
Views
5,561
Hey folks, I was just wondering what thoughts were about a completely 100% random number generator. I looked on The Google but didn't really open...
Replies
54
Views
16,569
Hello, Could somebody please help me out with coding a 'Random number generator' in vijeo citect. For example if i create an analog Local...
Replies
3
Views
3,772
http://www.codeproject.com/KB/recipes/SimpleRNG.aspx I came across this simple version a couple of years ago. It is simple enough to implement...
Replies
5
Views
3,574
Hi,Does anybody know if there are any routines in unity pro that produce random numbers like the routine rand() in C ?
Replies
1
Views
4,035
Back
Top Bottom