View Single Post
  #1  
Old 06-29-2011, 04:36 AM
new_horizon new_horizon is offline
Member
 
Join Date: Apr 2010
Posts: 43
Randomly Choosing a WaitTime

Hi All,

I am working on a program at the moment that requires an event to occur for 0.25s, but the timing of that event to occur at some point within a 1 second time frame.

I have tried setting up a new variable

probetime = random.choice([0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75])

and then using the following line...

yield viztask.waitTime(probetime) # wait before probe motion begins

The error message I receive is...

probetime = random.choice([0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75])
AttributeError: 'module' object has no attribute 'choice'

Am I trying to use the wrong commands here? I have used random.choice when dealing with speed in the past, but never time.

Thanks
Reply With Quote