Skip to main content
The Deno 2 Release Candidate is here
Learn more
method RandomUtil.prototype.drawRandomFromDict
import { RandomUtil } from "https://deno.land/x/sptaki@1.2.0/utils/RandomUtil.d.ts";

Draw a random (top level) element of the provided dictionary N times to return an array of N random dictionary keys Drawing can be with or without replacement

Parameters

dict: any

The dictionary we want to draw randomly from

optional
count: number

The number of times we want to draw

optional
replacement: boolean

Draw with ot without replacement from the input dict

Returns

any[]

Array consisting of N random keys of the dictionary