News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

nrandom function

Started by Oliver Scantleberry, May 07, 2016, 02:30:27 PM

Previous topic - Next topic

Oliver Scantleberry

Does anyone know how to initialize the "nrandom_seed" or use the "nseed function", whichever one I should use, to use the "nrandom" function without a repeating series of output numbers?

Never mind, I found my typo-- "invoke nseed, var". Thanks anyway.

Vortex

Hi Oliver,

Reading the manual \masm32\help\masmlib.chm :

Quotenrandom

nrandom proc base:DWORD

Description

A Park Miller random algorithm written by Jaymeson Trudgen (NaN) and optimised by Rickey Bowers Jr. (bitRAKE).

Parameter

1.base Zero based range for random output.

Return Value

Random number within range set in "base" in EAX.

Comments

The seed for the random algorithm is set as a variable of GLOBAL scope in a seperate procedure atached to the library module. The variable is nrandom_seed and this variable should be set with a DWORD size number prior to the use of this algorithm.

bluedevil

Quote from: Oliver Scantleberry on May 07, 2016, 02:30:27 PM
Does anyone know how to initialize the "nrandom_seed" or use the "nseed function", whichever one I should use, to use the "nrandom" function without a repeating series of output numbers?

Never mind, I found my typo-- "invoke nseed, var". Thanks anyway.

Hi, actually you have solved the problem, anyway i have made and published sources about random functions once upon a time. Maybe people need them again ;) Check the attachments.

Regards
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github