
fredebec
France
Asked

Hi,
I used to use a lot SleepRandom(a,b) in my EZ-scripts to simulate random behaviors.
I don't find the equivalent for Python scripting.
Outside of ARC, I use the "random" module (random module), but it does not seem to be present in ARC
returns "No module named random".Code:
import random
Is there a way to achieve the same thing than SleepRandom with Python scripting in ARC, or is there a way to import the python random module?
Thanks
Related Hardware EZ-B v4
Related Control
Script
Code:
I could have searching for it forever....
@DJ:
You can make it work the same way. You will need to add an additional nuget package to your ARC project:
Regarding the _random:
The other reason is too avoid duplicated import names for the same functionality: _module1 can be called from CPython (C) and a module1 (py) wrapper can coexist and internally calls _module1.
Note: Quoted parts/statements are copied from the internet.
These following attributes, part of the random module, don't work:
>>> random.uniform(1, 10) # Random float x, 1.0 <= x < 10.0
>>> random.randint(1, 10) # Integer from 1 to 10, endpoints included
>>> random.randrange(0, 101, 2) # Even integer from 0 to 100
>>> random.choice('abcdefghij') # Choose a random element
For example, I tried random.Randint , _random.randint , _random.Randint. Each of them returns
Code:
Is it me who is missing something... Again ?
Thanks @DJ