Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Random function

Name: Random function 2007-06-05 9:52 ID:aU7lW8Yy

Post your best ansi C function to get a random number in a specific range

Name: Anonymous 2007-06-05 23:17 ID:C0DCPVRs

am  i doing this rite?

unsigned int ___()
{
    unsigned long _;__asm__ __volatile__ ("rdtsc" : "=A" (_));
    unsigned int a,b,c,d,e,f=0;
    for(a=b=1; a<33; a++, b<<=1) {
        c = (((b&_)>>(a-1))<<2)+(((b&(_<<1))>>(a-2))<<1)+((b&(_<<2)>>(a-3)));
        for(d=e=1; d<c+1; d++,e<<=2);
        f|=e&0x1e;
    }
    return f;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List