Skip to content

random.choice()

github-actions[bot] edited this page Sep 30, 2024 · 8 revisions

chooses a random entry in an object
type: Function


arguments:

  • ?object Any
    thing that it'll randomly choose from
    if not given it'll default to the binder

list: pair:
const { random } = require('stews');

let arr = ["a", "b", "c"];

console.log(random.choice(arr));
const { random } = require('stews');

let obj = { key1: "val1", key2: "val2" };

console.log(random.choice(obj));
"c"
[ "key1", "val1" ]


Stews Docs 🍲

🛈 Stew 🛈 Soup
🛈 Noodle 🛈 random

Clone this wiki locally