How to pick a random number in C.
Arabica (1)

If you want a guess a number game, (to the ten thousands). Then this post is for you! This relies on an asm() command called "rdtsc". Which is used for random numbers or time (shift eax to the left 32 times to do this). Here is the function:

unsigned short rand() {
 unsigned short c; // We are going to set the value of eax to c after "rdtsc"
 __asm__("rdtsc\n" : "=a" (c));
 return c;
}

That is it!

You are viewing a single comment. View All
Highwayman (947)

I stand corrected lol.