function.array-rand

function.array-rand

[code=python]
import random¶

# for num_req == 1¶
result = random.choice(input.keys())¶

# for num_req > 1¶
result = random.sample(input.keys(), num_req)

import random ¶

# for num_req == 1 ¶
result = random.choice(input.keys()) ¶

# for num_req > 1 ¶
result = random.sample(input.keys(), num_req) ¶

# for arrays, replace "input.keys()" with "range(len(input))"

[/code]