Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Randomizer Code?
May 25, 2004, 4:04 pm
rate this thread
able to select different options, click enter and have it randomize those
I would like to create a random Diet Chart, On it will be 20 Different
Entrees, 30 Veggies, 10 Bread Selections, 20 Desserts and 10 wine selections
The user would be able to add as many or as few of each selection they would
like and also choose a number of days for the diet. Lets say they choose 10
Entrees, 20 Veggies, 5 Breads, 10 Desserts and 5 Wine selections for a Total
of 5 Days and click enter
They would then go to a results page that would look something like:
Day 1: Random Entree, Random Veggie, Random Bread etc
Day 2: Random Entree, Random Veggie....etc
Day 3: So Forth and So on.....
Does anyone know if how this can be done?
Re: Randomizer Code?
Most programming languages have functions to generate (pseudo-random)
just generate a random number from 1-20, and use this to pick the choice.
Something that complicates this is that sometimes the same choice will be
picked several times in a row, so you may want to make your code smarter by
(say) not picking something you've picked in (say) 3 days.