WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Method of Limits Program (

new_horizon 12-10-2012 05:08 AM

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.


sleiN13 12-11-2012 02:25 AM

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.

new_horizon 12-11-2012 03:02 AM

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 can I get it effectively "cross" these entries out once they have been randomly selected once?


new_horizon 12-11-2012 03:04 AM

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?


All times are GMT -7. The time now is 07:42 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC