VX Heaven

Library Collection Sources Engines Constructors Simulators Utilities Links Forum
[Previous] [Index] [Next]

pker's Random Number Generator

Author: pker

Author's notes

PKRNG is a random number generator. It can be used for MASM, TASM, FASM, etc. It containz four procedurez: __randomize, __random and __m_seq_gen and __random_rdtsc. __randomize procedure is for generating initial seed in the seed field, which specified as parameter. The _m_seq_gen procedure is used to generate m-sequence, which used by _random, which generate random numberz finally. __random_rdtsc is the simplest one, it just get the RDTSC and divide it by the range given as parameter.

How to use PKRNG

When using MASM or TASM to initialize seed field:

      mov   edi,offset dwSeed
      call  __randomize

The get a random number in eax:

      mov   eax,offset dwSeed
      mov   ecx,32                    ; get a random number between 0~31
      call  __random

Same thing happened with FASM:

      mov   edi,dwSeed
      call  __randomize

      mov   eax,dwSeed
      mov   ecx,32                    ; get a random number between 0~31
      call  __random


pkrng.zip1936PKRNGJan 2005MD5 sum 09c87fa9570e5a0221ec4c5e7448a95d

By accessing, viewing, downloading or otherwise using this content you agree to be bound by the Terms of Use! aka