← random operator page · numeric/random/ds/manual_ex_1
pandas ✅ · DuckDB ✅
random(DS_1, 5) on a dataset: the measure is replaced by draws.
Random, Example 1: "The operator returns a random decimal number >= 0 and <1." The page prints 0.3582791, 0.428819 and 0.715488 only to illustrate.
the identifiers are the page's; Me_1 holds numbers in [0, 1) that are the same on every run.
no engine can reproduce the printed draws, so Me_1 is blank in the expected file and the example is checked by that property.
DS_r := random(DS_1,5);
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 10 | A | 16.0 |
| 10 | B | 4.0 |
| 11 | A | 7.2 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 10 | A | |
| 10 | B | |
| 11 | A |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"}
]
}
]
}