Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (19 sloc) 673 Bytes
layout language permalink command
api-command
Python
api/python/sample/
sample

Command syntax

{% apibody %} sequence.sample(number) → selection stream.sample(number) → array array.sample(number) → array {% endapibody %}

Description

Select a given number of elements from a sequence with uniform random distribution. Selection is done without replacement.

If the sequence has less than the requested number of elements (i.e., calling sample(10) on a sequence with only five elements), sample will return the entire sequence in a random order.

Example: Select 3 random heroes.

r.table('marvel').sample(3).run(conn)
You can’t perform that action at this time.