Jump to content

generate random number in assembly 8086

- - - - -

  • Please log in to reply
1 reply to this topic

#1
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
is there a facility to generate a random number in assembly 8086??

#2
Sysop_fb

Sysop_fb

    Programmer

  • Members
  • PipPipPipPip
  • 160 posts
  • Location:Missouri
You could call the C function rand from assembly which is probably the easiest way.
You could write your own in assembly a number of different ways depending on how random you need it to be.
From getting the current time and coming up with a simple math algorithm. From allocating data and then using the memory address or using the garbage that's in that memory. Or go research psuedo random number generating algorithms and implement it in assembly.

There's also RNGers in hardware form that you can play around with interfacing if you're into system programming. Other then that I'm sure there's a cryptlib or rng library for assembly somewhere on the web.
"The best optimizer is between your ears" - Michael Abrash
Saying you can optimize a program is like saying you understand how a program works on every level of every facet on a specific machines configuration.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users