If I generate a number from 1 to 100, there is an equal chance to hit any number, but how do I get an exact % chance

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am creating a game, and I feel like I am going about the random generation of a number wrong. I have a set plan that the user has a 5% chance to win prize A, and a 10% chance to win prize B. 40% to win prize C, exc.



With that said, a random number is generated from 1-100 that lets me know what prize the person will be winning before they even know. An example would be, if the random number generated was 14. My logic tells me there was a 1/100 chance of hitting 14 just like there is a 1/100 chance of generating any number between 1-100.



What I would like to do is be able to have a realistic 5% chance of winning something, and a realistic %10 chance of winning something, and a realistic %40 chance of winning something without it feeling like really, every chance is 1% chance.










share|cite|improve this question





















  • What makes you think the answer is not obvious?
    – Christian Blatter
    Sep 8 at 12:38














up vote
0
down vote

favorite












I am creating a game, and I feel like I am going about the random generation of a number wrong. I have a set plan that the user has a 5% chance to win prize A, and a 10% chance to win prize B. 40% to win prize C, exc.



With that said, a random number is generated from 1-100 that lets me know what prize the person will be winning before they even know. An example would be, if the random number generated was 14. My logic tells me there was a 1/100 chance of hitting 14 just like there is a 1/100 chance of generating any number between 1-100.



What I would like to do is be able to have a realistic 5% chance of winning something, and a realistic %10 chance of winning something, and a realistic %40 chance of winning something without it feeling like really, every chance is 1% chance.










share|cite|improve this question





















  • What makes you think the answer is not obvious?
    – Christian Blatter
    Sep 8 at 12:38












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am creating a game, and I feel like I am going about the random generation of a number wrong. I have a set plan that the user has a 5% chance to win prize A, and a 10% chance to win prize B. 40% to win prize C, exc.



With that said, a random number is generated from 1-100 that lets me know what prize the person will be winning before they even know. An example would be, if the random number generated was 14. My logic tells me there was a 1/100 chance of hitting 14 just like there is a 1/100 chance of generating any number between 1-100.



What I would like to do is be able to have a realistic 5% chance of winning something, and a realistic %10 chance of winning something, and a realistic %40 chance of winning something without it feeling like really, every chance is 1% chance.










share|cite|improve this question













I am creating a game, and I feel like I am going about the random generation of a number wrong. I have a set plan that the user has a 5% chance to win prize A, and a 10% chance to win prize B. 40% to win prize C, exc.



With that said, a random number is generated from 1-100 that lets me know what prize the person will be winning before they even know. An example would be, if the random number generated was 14. My logic tells me there was a 1/100 chance of hitting 14 just like there is a 1/100 chance of generating any number between 1-100.



What I would like to do is be able to have a realistic 5% chance of winning something, and a realistic %10 chance of winning something, and a realistic %40 chance of winning something without it feeling like really, every chance is 1% chance.







random percentages






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Sep 8 at 12:21









Ugleh

1034




1034











  • What makes you think the answer is not obvious?
    – Christian Blatter
    Sep 8 at 12:38
















  • What makes you think the answer is not obvious?
    – Christian Blatter
    Sep 8 at 12:38















What makes you think the answer is not obvious?
– Christian Blatter
Sep 8 at 12:38




What makes you think the answer is not obvious?
– Christian Blatter
Sep 8 at 12:38










1 Answer
1






active

oldest

votes

















up vote
2
down vote













You can just used buckets. If you generate a 1, 2, 3, 4, or 5 they get prize A. If you generate a 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 they get prize B. Etc.






share|cite|improve this answer




















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "69"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2909569%2fif-i-generate-a-number-from-1-to-100-there-is-an-equal-chance-to-hit-any-number%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    You can just used buckets. If you generate a 1, 2, 3, 4, or 5 they get prize A. If you generate a 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 they get prize B. Etc.






    share|cite|improve this answer
























      up vote
      2
      down vote













      You can just used buckets. If you generate a 1, 2, 3, 4, or 5 they get prize A. If you generate a 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 they get prize B. Etc.






      share|cite|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        You can just used buckets. If you generate a 1, 2, 3, 4, or 5 they get prize A. If you generate a 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 they get prize B. Etc.






        share|cite|improve this answer












        You can just used buckets. If you generate a 1, 2, 3, 4, or 5 they get prize A. If you generate a 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 they get prize B. Etc.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Sep 8 at 12:24









        Stella Biderman

        26.2k63175




        26.2k63175



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2909569%2fif-i-generate-a-number-from-1-to-100-there-is-an-equal-chance-to-hit-any-number%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Carbon dioxide

            Why am i infinitely getting the same tweet with the Twitter Search API?