LOG IN SIGN UP
Documentation

randombool_seeded()

Identical to randombool, except takes an additional parameter, which is used to seed the random number generator.

This does not use secure random numbers and should not be used for cryptographic purposes.

This function is not prefixed with the std. namespace.

Format

BOOL
randombool_seeded(INTEGER numerator, INTEGER denominator, INTEGER seed)

Examples

1
2
3
4
5
6
7
set req.http.my-hmac = digest.hmac_sha256("sekrit", req.http.X-Token);
set req.http.hmac-chopped = regsub(req.http.my-hmac, "^(..........).*$","\1");
if (randombool_seeded(5,100,std.strtol(req.http.hmac-chopped ,16))) {
  set req.http.X-Allowed = "true";
} else {
  set req.http.X-Allowed = "false";
}