Mathmatical notation of random function

2.3k Views Asked by At

A function $f$ projecting from $\mathbb N$ to $\mathbb N $ is denoted as $f: \mathbb N \rightarrow \mathbb N$.

I is OK to denote the common random() function, i.e., without input parameters, as it is provided by many programming languages and databases, as follows?

$$ random: \rightarrow \mathbb R ^{[0,1]} $$

Or should I consider another notation, since functions are generally defined to project from one domain to another, rather than "from nothing" to the desired random domain?

Note that I do not know which hidden input parameters the various implementations of random are actually using. I want to define the function as simple and general as possible.

2

There are 2 best solutions below

5
On BEST ANSWER

It depends on your audience. A casual gang of programmers would probably rather understand something like $$ \mbox{random}: \{ \emptyset \} \to [0,1] \quad (*) $$ than the more precise description using random variables suggested by fellow user Hetebrij. These are measurable functions on some set of events $\Omega$ to $[ 0, 1]$.

Strictly speaking, the first version $\mbox{random}()$ is no mathematical function.

The number of arguments of a relation is called the arity which is zero in this case and makes $\mbox{random}()$ a candidate for a nullity function. One can consider constant functions, which assign the same value to all inputs as depending on zero arguments. Or on can see it as mapping argument tuples of length 0 to some constant, where one defines such tuples as $() = \emptyset$, this led to equation $(*)$.

As you indicated, the problematic bit, why it is no function, is that $\mbox{random}()$ is not constant. The implementation as some machine function of a computer is indeed $$ \mbox{random}(s) $$ where $s$ is some state of the machine which is derived from outside the machine (measuring user input, device parameters, coming from a network connection, observing radiation, etc.). An isolated computer is deterministic, produces the same output for the same input.

0
On

Consider the notation $X \sim U( [0,1])$, which states that $X$ is a uniform random variable which takes values in $[0,1]$.