RANDOM function
#1

Hi all. I just was playing around with some code and numbers.. and i came up with this. I believe this to be %99.999 truely random. I have NEVER seen it return the same number. I'm NOT even lying! If you dont believe me, test it. Anyway, heres the code for it:

pawn Код:
stock rand()
{
    new num=0;
    new t, t2, t3;
    for(new ct=0; ct<50; ct++)
    {
        num += ct;
        num = random(num * 2);
        num -= 4 * 2 / 7;
        num += random(num);
        num += 5 * ct;
        num += random(ct * 5);
        for(new dx=0; dx<ct; dx++)
        {
            if(num < 0)
            {
                num += 5000;
                num *= -2;
                num -= random(dx + 50);
                if(num > 500000)
                {
                    num -= 10000;
                }
            }
            else if(num > 5000)
            {
                num += random(5000);
            }
           
            gettime(t, t3, t2);
            t += t3 - t2;
            num += t * 2 - 50;
        }
        if(num > 500000)
        {
            num -= 350000;
        }
        new g, g1, g2;
        getdate(g, g1, g2);
        g -= g1 + g2;
        num += g * 2 - 8 + 6;
    }
    return num;
}
hehe. Lemme no wut i think! THX!
Reply
#2

Bullshit.

Ahh joke, it's gud.

EDIT: this is random too:
pawn Код:
new n1,n2,n3,n4,n5;
n1 = random(100);
n2 = random(n1);
n3 = random(n2);
n4 = random(n3);
n5 = random(n4);
return n5;
:P
Reply
#3

well, i updated it. Is the way i test it .. a good way to test it? i am testing right now. i did add a delay of 100 ms so i can c if theres a message of same nums.. but.. idk if im testin it right. i also lowered the number of tests to 1k. Lemme no wut u think now.
Reply
#4

ok.. well, mines more.. cool looking. p.s. u updated it FOR THE LAST TIME. Please lemme no wut u guys think about it. THX MAN!

EDIT: UPDATED AGAIN!!!!!!!! AAAAAAAAAAAAAAAAAAAAAAHHHHHHHH!!!!!!!!!!!
Reply
#5

Here you go, most simple random code ever:
pawn Код:
stock Random(min, max){ return min + random(max - min); }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)