Quinai's Forum Posts

  • 2 posts
  • What you're trying to find is the logarithm, not the power.

    For 8^2 = 64, 8 is the base, 64 is the power and 2 is the exponent. The exponent equals the logarithm of the power as long as you don't change the base.

    http://sourceforge.net/apps/mediawiki/c ... xpressions <-- Look under "Math".

    Use ln for base e (Euler's number, approx. 2.718) or log for base 10.

    For example: 10^x = 1000. To find x, just do:

    log(1000)[/code:3jalj99k]
    ...which gives you 3.
    
    If the base isn't 10 or [i]e[/i], use this instead: [code:3jalj99k]log(power) / log(base)[/code:3jalj99k]
    (You can use [b]ln[/b] instead of [b]log[/b], the result should be the same.)
    
    Using the example above, 8^2 = 64, you get [code:3jalj99k]log(64) / log(8)[/code:3jalj99k]
    ...and that should give you 2.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The math geek in me forced me to register just to answer this question.

    There's a really simple way to get almost exactly what you're after: For every random value you need, generate two random values and pick the lowest. For values of 1-100, that should give you:

    1-30: 51% of the time

    31-60: 33% of the time

    61-100: 16% of the time

    1-10: 19% of the time

    91-100: 1% of the time

    Should be about the same for 0-100.

  • 2 posts