This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:sql:functions:random [2010/07/09 20:25] els |
dev:sql:functions:random [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 19: | Line 19: | ||
== seed == | == seed == | ||
- | Optional. An integer //n// is an integer indicating the number of digits to the right of the decimal. The default is 0. | + | Optional. A literal integer //n// is an integer indicating the number of digits to the right of the decimal. The default is 0. |
===== Example ===== | ===== Example ===== | ||
Line 51: | Line 51: | ||
{{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} | ||
- | |||
- | |||
- | {{page>:top_add&nofooter&noeditbtn}} | ||
- | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | ||
- | ====== Omnidex SQL Function: $RANDOM ====== | ||
- | {{page>:sql_bar&nofooter&noeditbtn}} | ||
- | ===== Description ===== | ||
- | Returns a pseudo-random number. The term "pseudo-random" is used as randomization is done using the Posix rand and srand functions. While these routines do provide satisfactory randomization for most applications, the numbers generated are not entirely random. | ||
- | |||
- | If seed is specified, it is used to start the random number generator. Note that only a single $random stream can be used in the process. If there are multiple $random functions in a select, only the first seed is used. Seed must be a literal. The return value is INTEGER length 4. | ||
- | ===== Syntax ===== | ||
- | $RANDOM[(seed)] | ||
- | |||
- | == (seed) == | ||
- | |||
- | Optional. Seed must be a literal. | ||
- | |||
- | |||
- | ===== Example ===== | ||
- | ==== Example 1 ==== | ||
- | $RANDOM(9) | ||
- | |||
- | 68 | ||
- | 6151 | ||
- | ... | ||
- | |||
- | |||
- | {{page>:bottom_add&nofooter&noeditbtn}} |