Skip to main content

Random

Note

Working with statistics? See Random (Statistics).

Returns a random number. One can specify the seed using random_seed(Integer).

Syntax

random()
random(Integer)
random(Real)
random(Integer, Integer)
random(Real, Real)

Description

Returns a random number in the interval (0,1).

calc.random1.calc.png

Given an integer n, returns a random integer number in the interval [0,n) (if nn is positive) or (n,0] (if nn is negative).

calc.random2.calc.png

Given a real x, returns a random real number in the interval [0,x) (if xx is positive) or (x,0] (if xx is negative).

calc.random3.calc.png

Given two integers numbers a and b, returns a random integer in the interval [a,b].

calc.random4.calc.png

Given two real numbers aa and bb, returns a random real number in the interval [a,b][a,b].

calc.random5.calc.png