INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Random numbers

Random numbers

(OP)
Hi,

Can any of you clever chaps give me(lazy I know!) structured text code that will generate a pseudo random number between 1 and 10?

Thanks

RE: Random numbers

If you do not need the random number often, use the seconds lower digit of a real-time clock.

RE: Random numbers

(OP)
Thanks for your replies,

I'll try and get the ladder version to work.

RE: Random numbers

I love ST programming, what processor are you using, I'll give it a shot.

RE: Random numbers

By the way, what may be a real life PLC application that requires a random number generation?

RE: Random numbers

The generation of random numbers for timers. I use them regularly to insert different values into timers for swimming pool water features. Sometimes the randomly generated timer values represent 2 decimal places. Sometimes minutes. Depends on the water features at hand.

RE: Random numbers

(OP)
Thanks everyone,

These random numbers will be used for timer values. Its for a security lighting project I'm working on.

The PLC is a WAGO 750-841 and the software I'm using is CoDeSys.

Happy New Year.

RE: Random numbers

Nick, did you leave a request here for a simpler version of a number generator? If so, leave it again and I will see if I can post it somewhere for you to pick up.

RE: Random numbers

(OP)
OldPfart, yes I did request your simpler version.
Thanks

RE: Random numbers

Nick, I have not forgotten you. Just had one end up and the other end down (inverted). Not a pretty sight.

Will see if I can set something up for you tomorrow.

Bob

RE: Random numbers

Nick, still got head down and a*** up. Have not forgotten you.

Pleas be patient for another day or two.

RE: Random numbers

Nick90,

Still looking for help with random numbers?  In MATLAB, use the command rand.  I beleive C/C++ also have the function rand().

RE: Random numbers

As I was reading the replies...someone asked....what would you use it for...and bingo...olphart said for water feature timers.  Whoa...scary...that is EXACTLY what I used it for as well.  Did a control system for a water park feature that would do a random time for the events to occur.

http://www.cherry-hill.com/GrantsGulch.htm

fun project....

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Related News

Resources

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close