I want to know if there a routine or an instruction to generate a random number using assembly
on 8086.
any help will be appreciated.
I want to know if there a routine or an instruction to generate a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The most common way is to use the timestamp. In 32 bit mode it can be done by
rdtscinstruction, in 16 bit mode: by using function 0 of BIOS interrupt 1A.Because it’s a timestamp, avoid using it frequently (because of lack of proper dispersion), and use it as seed for an pseudo-random number generator. When you need just one random value, you can use the timestamp directly.
Usually a simple pseudo-random number generator is enough:
And there is also wiki