Grow your CSS skills. Land your dream job.

number possible outcomes of an event

  • # March 14, 2012 at 1:54 am

    Hi guys,
    i need to calculate possible number of outcomes with detail screens.
    the detail are: we have 1 textbox in which there has to enter any number from 0 to 7. There are 13 categories of the outcomes but average of all outcomes should be equal to the number entered in the texbox.


    for example : textbox : __enter a number from 1 to 7__(if 3)______.

    categories 1: 1, 2, 3, 4, 5, 6, 7
    categories 2: 1, 2, 3, 4, 5, 6, 7
    categories 3: 1, 2, 3, 4, 5, 6, 7
    categories 4: 1, 2, 3, 4, 5, 6, 7
    categories 5: 1, 2, 3, 4, 5, 6, 7
    categories 6: 1, 2, 3, 4, 5, 6, 7
    categories 7: 1, 2, 3, 4, 5, 6, 7
    categories 8: 1, 2, 3, 4, 5, 6, 7
    categories 9: 1, 2, 3, 4, 5, 6, 7
    categories 10: 1, 2, 3, 4, 5, 6, 7
    categories 11: 1, 2, 3, 4, 5, 6, 7
    categories 12: 1, 2, 3, 4, 5, 6, 7
    categories 13: 1, 2, 3, 4, 5, 6, 7

    the average shud be 3. This is one possibility i need number of possibilities with screens like this.

    can any one help me out in this i guess this to be deal with some probability distributions.

    # March 14, 2012 at 2:49 am

    96889010407 possible outcomes lol http://jsfiddle.net/SzNrH/
    Can you elaborate further as I think I’m a little confused as to what you are trying to achieve

    # March 14, 2012 at 3:07 am

    1. There is PERFORMANCE EVALUATION CALCULATOR in which
    one text box of average rating of a employee in which we need to enter a number from 0 to 7.

    2. Next will show the 13 categories which contains detail ratings in each category. it could be in between 0 to 7. and by taking average of all will give 3 rating.

    I need all possible slides with different possible outcomes in each category but the average should be same as entered in the textbox.

    Hope you got my point :)

    # March 14, 2012 at 3:10 am

    so you’re trying to generate 13 random numbers whose average value is equal to the value you enter?

    # March 14, 2012 at 3:17 am

    yes that random number’s average should be equal to what you have entered first. i need category wise number with possible outcomes.

    # March 14, 2012 at 9:49 am

    Ok this might take me some time
    Don’t think I know how to do this on paper let alone in JavaScript :D

    # March 14, 2012 at 10:27 am

    It’s impossible…random numbers are..ahem..random. If you add range limiters they become ‘unrandom’.

    The first ‘random’ number decided upon would further limit the range of the next ‘random’ number.

    # March 14, 2012 at 11:02 am

    I’m just gonna give up now then
    Got this far http://jsfiddle.net/EL3df/4/
    It’s driving me crazy ha

    # March 14, 2012 at 5:58 pm

    I don’t think this is too hard, it’s just some basic math..

    As an example: If you need the average of 13 numbers to be 3, then the total of those 13 numbers needs to be 39 (13 * 3 = 39). So you start off with a variable of value ’39’ (or just ‘what average value needs to be’ * ‘number of inputs’). Every time the user inputs a value between 1-7 then you subtract that number from the total. So if they select ‘7’ for the first input then the new running total is ’32’. Basically all 13 inputs have to total 39. If they have 5 inputs left and the running total is down to ‘5’ then they are restricted to enter only ‘1’ for the final 5 inputs.

    I don’t have time to code something out but it doesn’t seem too tricky once you wrap your head around it!

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".