Closed
Description
Problem
The examples for the scripts.lib RNG methods do not show how to generate a random value.
Context
Affects:
- https://wiki.hackmud.com/scripting/scripts.lib/JSF
- https://wiki.hackmud.com/scripting/scripts.lib/LCG
- https://wiki.hackmud.com/scripting/scripts.lib/mulberry32
- https://wiki.hackmud.com/scripting/scripts.lib/sfc32
- https://wiki.hackmud.com/scripting/scripts.lib/xoshiro128ss
LCG current:
function(context, args) {
const l = #fs.scripts.lib();
my_seed = 12345;
return l.LCG(my_seed);
}
LCG example improvement:
function(context, args) {
const l = #fs.scripts.lib();
const seed = 12345;
const rng = l.LCG(seed);
const random_value = Math.floor(rng() * 10) // random value from 0 (inclusive) to 10 (exclusive)
return random_value
}
- scripts.lib JSF Change example and update description #455
- scripts.lib LCG Change example and update descriptions #456
- scripts.lib xoshiro128ss Change example and update descriptions #457
- scripts.lib mulberry32 Change example and update descriptions #458
- scripts.lib sfc32 Change example and update descriptions #459
Metadata
Metadata
Assignees
Labels
No labels