|
#1
|
|||
|
|||
Method of Limits Program
Hi All,
This is a programming questions really, opposed to a Vizard specific question. I want to set up an experiment where I have a vehicle traveling at a choice of six speeds (ranging from 20 mph to 60 mph). I'd like the program to pick each speed at random, but not use each speed on more than four occasions. So if 20 mph has been presented four times, I'd like the program to select one of the speeds that has not exceeded the "max trials" if you like? Can anyone show me the best way of achieving this? I have it working but the code is very clunky and long winded. Thanks |
#2
|
|||
|
|||
You could just create a list with all speeds in it four times than randomize the order of the list and pop a new speed from it.
|
#3
|
|||
|
|||
That is true, but the issue is how to ensure that the program does not select the same speed twice (e.g there will be four entries of 30mph...how can I get it effectively "cross" these entries out once they have been randomly selected once?
T |
#4
|
|||
|
|||
Sorry I've just re-read that. What I mean is if there are four entries for each speed, how can I remove them from the array once they have been used?
Thanks |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
User keyboard input without halting the program | Zhi | Vizard | 2 | 06-23-2011 12:53 PM |
How can i import the code form a Java program to Vizard? | alberto_redo | Vizard | 1 | 10-07-2010 12:18 PM |
How do I run a destructor before the end of the program? | EnvisMJ | Vizard | 3 | 12-14-2009 05:17 PM |
Get position data in an own little program | Researcher | Precision Position Tracker (PPT) | 2 | 02-01-2006 02:55 AM |
Loading .3ds-Files without interrupting Program flow | Stefan | Vizard | 10 | 06-08-2005 04:44 PM |