# Chapter 18. Random values

When developing a Rax program, having random values can make it easier to test code. In Rax, each base type has its own random generator. The syntax is:

`?`<type>`?`

Therefore, to get a random boolean, use `???`, for a random number, use `?#?` and so on for `?&?`, `?\$?`, `?^?`, `?~?`, `?@?`, `?|?`, `?%?`. The ordered sets, tuples and functions do not have a dedicated random generator. With these base random generators it is easy to generate random test data. For example, the lines below generate some test sets.

```    {\$}:     A := project[?\$?]{1..5};
{[\$,#]}: B := project[?\$?, ?#?]{1..500};
{[#,@]}: C := project[?#?, ?@?]{1..50};
```

The table below shows the random operators and their ranges.

Table 18.1. Random operators and their ranges

OperatorRange
`???` `[false, true]`
`?#?`

```[−9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807]``` or put another way ```[−(263) .. 263 − 1]```

`?&?` `[0.0 .. 1.0>`
`?\$?` Probability Type of string generated
1/256 Empty string
3/256 Repeat previous string.
29/256 Repeat one character between [10..20] times.
35/256 Pseudo number between [4..20] digits.
93/256 Random printable characters. [10..20] long.
95/256 A pseudo pronounceable word or domain, possibly with digits.
`?^?` From 0 to 999 years.
`?~?` From 0 to 11 months plus 0 to 30 days.
`?@?` A date between the year 1600 and 2600.
`?|?` An interval starting between the year 1600 and 2600 with a duration from 0 to 999 years.
Note: none of these random values are based on secure random values and should, therefore, not be used in any way related to security. Also note: nobody expects the Spanish Inquisition.