tencent cloud

dataset.random
Last updated: 2025-03-11 19:41:14
dataset.random
Last updated: 2025-03-11 19:41:14
dataset.random can randomly obtain a row from a parameter file, and it is mainly used in the primary function.
random(filename: string): Record<string, any>

Parameters

Parameter
Type
Description
fileName
string
The names of the parameter files that are obtained.

Return

Type
Description
Record<string, any>
A row of parameters that are randomly obtained.

Usage Examples

Randomly obtain a row from a parameter file:
import dataset from 'pts/dataset';

export default function () {
// Parameter file 'test.csv'
// name,value
// 1,111
// 2,222
// 3,333
const record = dataset.random('test.csv');
// Output '{"name":"2","value":"222"}'
console.log(JSON.stringify(record));
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback