Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to pick a random number in C.
Arabica

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:

That is it!

Voters
Ibraheemhunaity
bornengineer
JulianoEletroni
slanza
DUDEMASTER169
DanielRDorado
sequicode8
Highwayman
Arabica
Comments
hotnewtop
wynnepaton

Hi,

A really stupid question here!

Does any of the code specify the range of the random number generated?

Thanks,

Catherine

Highwayman

I stand corrected lol.