## ? Roll

One-argument form See also two-argument form Deal

Generates numbers chosen at random from the series of the first N integers which start at the index origin (ŒIO),where N is specified by the right argument. In the examples below ŒIO is set to 1, the default.

                 ? 100                   (Generates  a  random   number   between  1
            14                            and 100)
                 ? 10 100 1000           (Generates 3 random numbers, the first
            10 39 520                     between 1 and 10, the second between
                                          1 and 100, the third between 1 and 1000)
                 DATA „ ?100 ½ 100       (Generates 100 random numbers in the range
                                          1 to 100 - not necessarily unique)
                 ?(3½5) (2 3½10)
            1 4 3     6  3  1
                      7  7 10

Note: The system variable ŒRL (random link) contains a value used to generate random numbers. To generate the same number(s) on two occasions, set ŒRL to the same value before each use of ?.

Topic: APLX Help : Help on APL language : APL Primitives : ? Roll

[ Previous | Next | Contents | Index ]