It depends on the range of random numbers you need and how often you apply to them.
In most cases asynchronous reading of free running counter is good enough.
You can have one by running a PLSY instruction in continuous mode.
Then read as many last digits as you need from D8140 register..
Thanks for your replay. I want to generate random numbers between 2 to 300. I want to use it in every execution cycle contineously. I would be very greatful if you tell me in details, I am new in PLC.