Skip to content

Random Number API

Nenkai edited this page Jul 13, 2024 · 3 revisions

Random API

< MRandom Reference Class >

Getting Random Integer

// Getting a number from a range
var value = pdistd::MRandom::GetValue(0, 10);

// Getting a float from a range
var float_value = pdistd::MRandom::GetValue(0.0, 10.0);

Pseudo-Random

var rand = main::pdistd::MRandom();    
rand.mt_seed = 42;

// You could also set it from the time (good practice)
rand.mt_seed = main::pdistd::GetSystemTimeMicroSecond();

var seeded_value = rand.getMTInt();
var value_from_range = rand.getMTInt(0, 10);
var float_value = rand.getMTFloat(0.0, 10.0);
Clone this wiki locally