random()
Was this page helpful?
Retrieves values at random from MTS in the input stream, based on a count or percentage.
Syntax
random([count=c][, percentage=pct][, by=grp])
Parameter definitions
Parameter | Type | Description |
---|---|---|
count | integer. Default is None . | Optional: Number of values to pass through to the output stream. Mutually exclusive with percentage . |
percentage | Double,0.0 < percentage ≤ 1.0Default is None . | Optional: Percent of values to pass through to the output stream. Mutually exclusive with count . |
by | string or list of strings. Default is None. | Optional: Names of properties to group the output by |
Returns a stream
Examples
#Return 5 random cpu utilization values data('cpu.utilization').random(5) #Return a random 5 percent of cpu utilization, grouped by 'env' data('cpu.utilization').random(percentage=.05, by='env') #Return 10 random cpu utilization values grouped by env and datacenter data('cpu.utilization').random(10, by=['env', 'datacenter'])