2/9/2015 1:03 PM | |
Posts: 3 Rating:
|
If you want truly random number read the noise from an analogue input. |
2/9/2015 1:53 PM | |
Posts: 5225 Rating:
|
Nice one Robster! ... OSCAT? (smile) I do however think it is worth asking Rikkstendal: Which CPU do you intend using? If for example you intend using the S7-1200, you will have an issue with the Time_Tck() function. But that can be remedied (somewhat) by having a 1ms timer run continuously in the background and then using the time value from that. You might however experience an issue when wishing to extract a random value on power-up. Robster, I would suggest for a random value [0.0 .. 1.0]: #rRandom := 0.5 * (1 + SIN(#rTime) ); Greetings. |
Last edited by: William B. at: 2/9/2015 1:55:44 PMrange -> REAL |
|
2/14/2015 7:16 PM | |
Posts: 8946 Rating:
|
A couple of years ago I do a random number generator for Step7. The quality of random numbers is not very high, but mostly suffizient.
Have a look at attachement. Attachmentrandom.zip (1011 Downloads) |
This contribution was helpful to
3 thankful Users |
12/7/2015 10:58 PM | |
Posts: 6 Rating:
|
Hi.
There is an additional library to do this, I put the link and wait help you
Regards Entry ID:29851674
|
Follow us on