random
#4

To insert a percentage sign you have to use %%.

As for floats, ****** made this:

pawn Код:
frandom(Float:max, Float:min = 0.0, dp = 4)
{
    new
        // Get the multiplication for storing fractional parts.
        Float:mul = floatpower(10.0, dp),
        // Get the max and min as integers, with extra dp.
        imin = floatround(min * mul),
        imax = floatround(max * mul);
    // Get a random int between two bounds and convert it to a float.
    return float(random(imax - imin) + imin) / mul;
}
Reply


Messages In This Thread
random - by speed258 - 05.04.2013, 15:10
Re: random - by RajatPawar - 05.04.2013, 15:12
Re: random - by speed258 - 05.04.2013, 15:57
Re: random - by MP2 - 05.04.2013, 15:57

Forum Jump:


Users browsing this thread: 1 Guest(s)