Randomizer Code?

Discussion in 'HTML' started by gcc, May 25, 2004.

  1. gcc

    gcc Guest

    What I want to do is set up on a page a List of options and have a user be
    able to select different options, click enter and have it randomize those
    selected options.

    For Example:

    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?
     
    gcc, May 25, 2004
    #1
    1. Advertising

  2. gcc

    C A Upsdell Guest

    "gcc" <> wrote in message
    news:U7Ksc.487$...
    > What I want to do is set up on a page a List of options and have a user

    be
    > able to select different options, click enter and have it randomize those
    > selected options.
    >
    > For Example:
    >
    > 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?


    Most programming languages have functions to generate (pseudo-random)
    numbers: e.g. JavaScript has Math.random() . If you have (say) 20 choices,
    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.
     
    C A Upsdell, May 25, 2004
    #2
    1. Advertising

  3. gcc wrote:

    > 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


    Use a server-side script. And if the number of different meals to choose
    from is large (choose your own definition of 'large'), then use a database
    too.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, May 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron
    Replies:
    1
    Views:
    2,721
    Showjumper
    Jun 24, 2003
  2. Ian
    Replies:
    0
    Views:
    1,395
  3. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,300
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  4. keithb
    Replies:
    1
    Views:
    940
    Bruce Barker
    Mar 29, 2006
  5. matt

    image randomizer not working

    matt, Jan 18, 2004, in forum: Javascript
    Replies:
    4
    Views:
    85
    Dr John Stockton
    Jan 19, 2004
Loading...

Share This Page