Simplicty and flexibility!


Function::Mathematical

Random


Parameters


Returns/Result


Examples


Reference

random

Type

Math Function

Purpose

The random function returns a random decimal value between 0 and 1 (inclusive). No value is required in the function's argument.

Syntax

random( )

Returns

A number between 0 and 1 (inclusive).

The result of the random function is really a pseudo-random number calculated by a formula, not a true random number.

Usage

The following steps are used to generate a random integer using the random function:

  • Determine the range (number of possibilities) in which the random number must fall. For example, if the desired range is between 10 and 100, the range is 90.

  • Determine starting value (smallest integer) of the range. In the example 10-100, the starting value is 10.

  • Use the following formula to generate a random integer:

 ( random( ) * RANGE) + STARTING VALUE

 

Examples

floor( random( ) * 9)

Returns: A random integer between 0 and 9.

 

floor( random( ) * 90) + 10) )

Returns: A random integer between 10 and 100.

 

In these examples, floor rounds down the result to the nearest integer.

See Also


On the forum about Random

On the blog about Random

New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

One of the most popular and frustrating functions or should we rather say functionalities in DataEase is "Sequence from". Basically this is a "guaranteed" sequence number, and it is great when you need records to be in sequence and have a unique number....

Product: Dataease [{8}]FIVE. Written by DataEase 01/10/12 at 07:42:05

Re:New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

Am I right in stating that this function replaces the Set/Get Uneek CDF? And is it right to assume that this unique id can be used to retreive records etc? thanks...

Product: Dataease [{8}]FIVE. Written by Josef Vella 11/10/12 at 12:39:01

Re:Re:New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

Hi! This is simply a function that genearte a "guaranteed" unique ID that one can use as one please, but the short answer to the question is... Yes! In PRISM 9, and ID like this will be an integral part of the database design, but till then you will ne...

Product: Dataease [{8}]FIVE. Written by DataEase 11/10/12 at 12:49:33


dg3_HelpView