tencent cloud

Tencent Cloud Observability Platform

dataset.random

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 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));
}


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백