Skip to content

Pseudorandom number generator

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt
Notifications You must be signed in to change notification settings

flashultra/hxprng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hxprng

At the moment implements only PCG random number generator

Usage

You should call method random(n:Int) . This will return a random integer between 0 included and n excluded.

 var pg: PCG32 = new PCG32();
 var rnd : Int = pg.random(6) + 1; //add 1 to return a value between 1 and 6 (included)
 trace("Dice : " + rnd);

To get random number between range ( min - max) you can use randomFromRange(min:Int, max:Int) , where min < max

 var pg: PCG32 = new PCG32();
 var month : Int = pg.randomFromRange(1,12); // return a value between 1 and 12 (included)
 trace("Month : " + month);

License

Apache 2.0 is used for PCG number generator
MIT license for all other number generators

About

Pseudorandom number generator

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt

Stars

Watchers

Forks

Packages

No packages published

Languages