Pseudorandom generator in Assembly Language

前端 未结 9 1025
予麋鹿
予麋鹿 2021-01-05 11:07

I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external libra

9条回答
  •  别那么骄傲
    2021-01-05 11:52

    Volume 2 of The Art of Computer Programming has a lot of information about pseudorandom number generation. The algorithms are demonstrated in assembler, so you can see for yourself which are simplest in assembler.

    If you can link to an external library or object file, though, that would be your best bet. Then you could link to, e.g., Mersenne Twister.

    Note that most pseudorandom number generators are not safe for cryptography, so if you need secure random number generation, you need to look beyond the basic algorithms (and probably should tap into OS-specific crypto APIs).

提交回复
热议问题