Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

generate random number in assembly 8086

random number assembly

  • Please log in to reply
1 reply to this topic

#1 eman ahmed

eman ahmed

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 79 posts

Posted 25 December 2011 - 09:51 AM

is there a facility to generate a random number in assembly 8086??
  • 0

#2 Sysop_fb

Sysop_fb

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 151 posts
  • Location:Missouri

Posted 25 December 2011 - 11:04 AM

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.
  • 0
"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.





Also tagged with one or more of these keywords: random number, assembly

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download