Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 752 Bytes

README.md

File metadata and controls

21 lines (18 loc) · 752 Bytes

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