Topic: APLX Help : Help on APL language : APL Primitives : ? Roll
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

? 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 | APL Home ]