← random operator page · numeric/random/comp/manual_ex_2
pandas ✅ · DuckDB ✅
random on a component inside calc, next to the seed Me_1.
Random, Example 2: "The operator returns a random decimal number >= 0 and <1." The page prints 0.7545341, 0.3457166 and 0.5183224 only to illustrate.
Me_2 holds numbers in [0, 1) that are the same on every run; the seed Me_1 (16.0, 4.0 and 7.2) is kept and compared as written.
no engine can reproduce the printed draws, so Me_2 is blank in the expected file and is checked by that property.
DS_r := DS_1 [ calc Me_2 := random( Me_1, 8 ) ];
| 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 | Me_2 |
|---|---|---|---|
| 10 | A | 16.0 | |
| 10 | B | 4.0 | |
| 11 | A | 7.2 |
{
"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"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}