The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Random Select ?

TetsugenTetsugen Registered User regular
edited February 2008 in Help / Advice Forum
Looking for some sort of application that allows you to enter 5-10 items and then randomly selects one. Does this exist or am I just asking too much ?

Tetsugen on

Posts

  • falsedeffalsedef Registered User regular
    edited February 2008
    What do you mean by "items"? Just the name of an item?

    falsedef on
  • ecco the dolphinecco the dolphin Registered User regular
    edited February 2008
    Could you use a dice instead?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • falsedeffalsedef Registered User regular
    edited February 2008
    <script>
    var item = prompt("Item? Enter nothing to stop", "");
    var arr = new Array();
    
    while( item != "" ){
        arr.push( item );
        item =  prompt("Item? Enter nothing to stop", "");
    }
    do {
        var rand = Math.random();
        rand = rand * arr.length;
        var conf = confirm("A rand item out of " + arr.length + " items :\n\n" + arr[((Math.floor(rand)%arr.length))] + "\n\nAnother?");
    } while( conf )
    </script>
    

    Stick that code in an HTML file. Reload when you want a new set.

    It'll also randomly delete your harddrive, for extra fun.

    falsedef on
  • JNighthawkJNighthawk Registered User regular
    edited February 2008
    Homework?

    JNighthawk on
    Game programmer
  • falsedeffalsedef Registered User regular
    edited February 2008
    JNighthawk wrote: »
    Homework?

    Didn't look like a homework question, otherwise I wouldn't have bothered with code.

    If it is, then it's a really bad question, even for cheating.

    falsedef on
  • ConceptConcept Registered User regular
    edited February 2008
    I give you, the decision decider:

    http://decider.skizzers.org/

    Concept on
    [SIGPIC][/SIGPIC]
Sign In or Register to comment.