tags:

views:

32

answers:

3

I need a random number generator function written in nasm. I'm sorry for asking, but I couldn't find any!

A: 

I don't know NASM, and I'm not in the habit of writing code on demand, unless they pay me.

But, here are algorithms you could investigate:

Merlyn Morgan-Graham
+1  A: 

In many cases a call to rdtsc is enough. Anyway, it depends on your needs. It's perfect when you need a small random number rarely: rdtsc % N, or as seed for more complicate algorithms for other cases.

ruslik
+1  A: 

Among other things, Agner Fog has a random number generator written in assembly, see here.

PhiS