The Random function
returns a random number that is greater than or equal to 0 and less
than 1. Once the random value is seeded, every time the function is
called, the same value is returned for the same seed.
Returns: A
number.
Syntax
>>-Random--(--+-------------------+--)-------------------------><
'-NumericExpression-'
Parameters
- NumericExpression
- Specifies the number that is to be used as a seed for the function.
- If a seed is provided, the function returns a random number that
is greater than or equal to 0 and less than 1. The seed is associated
with the generated random number. The function returns the same random
number for the same seed.
- If a seed is not provided, the function returns a random number
that is greater than or equal to 0 and less than 1.
Description
You can specify a number as
a seed for the Random function. The first time
a seed is specified, it is associated with the generated random number.
If the same seed is used again, no matter how many times it has been
used, the same number is generated.
When you have result set
caching enabled, the returned random number will be cached. If you
run the same query again before the result set cache is cleared, the
cached random number is returned.
Example
This example uses the Random function
to return a random number.
Query:
WITH MEMBER [Measures].[random value] as RANDOM()
SELECT {[Measures].[random value]}
ON COLUMNS
FROM [Price Analysis]
Related functions
The Rand function
is a synonym for the Random function.