g.js — graphical objects for JavaScript

randomSamplerandomSample

Take a random sample from a list.

g.randomSample([1, 2, 3, 4, 5, 6], 3, 48);

With a different seed:

g.randomSample([1, 2, 3, 4, 5, 6], 3, 11);

Unlike pick, randomSample will never return more than the original amount:

g.randomSample([1, 2, 3], 10, 44);

Parameters

  • l: The input list.
  • amount: The amount of items to take.
  • seed: The random variation.

See Also

  • pick: Take random items from a list.
  • shuffle: Randomly reorganise items in the list.