A.42 library(random): Random numbers
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(random): Random numbers
          • random/1
          • random_between/3
          • random/3
          • setrand/1
          • getrand/1
          • maybe/0
          • maybe/1
          • maybe/2
          • random_perm2/4
          • random_member/2
          • random_select/3
          • random_subseq/3
          • randset/3
          • randseq/3
          • random_permutation/2
          • random_numlist/4
    • Packages
Availability::- use_module(library(random)).(can be autoloaded)
Source[det]random(+L:int, +U:int, -R:int)
[det]random(+L:float, +U:float, -R:float)
Generate a random integer or float in a range. If L and U are both integers, R is a random integer in the half open interval [L,U). If L and U are both floats, R is a float in the open interval (L,U).
deprecated
Please use random/1 for generating a random float and random_between/3 for generating a random integer. Note that random_between/3 includes the upper bound, while this predicate excludes it.