LOG IN SIGN UP
Documentation

randomint()

Returns a random integer value between from and to, inclusive.

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

INTEGER
randomint(INTEGER from, INTEGER to)

Examples

1
2
3
4
5
6
7
8
9
10
if (randomint(0, 99) < 5) {
  set req.http.X-ABTest = "A";
} else {
  set req.http.X-ABTest = "B";
}
if (randomint(-1, 0) == -1) {
  set req.http.X-ABTest = "A";
} else {
  set req.http.X-ABTest = "B";
}