Skip to content
Eddie Kohler edited this page Oct 17, 2017 · 3 revisions

RandomSample Element Documentation

NAME

RandomSample — Click element; samples packets with some probability

SYNOPSIS

RandomSample([P, KEYWORDS])

Ports: 1 input, 1-2 outputs
Processing: agnostic, but output 1 is push

DESCRIPTION

Samples packets with probability P. One out of 1/P packets are sent to the first output. The remaining packets are dropped, unless the element has two outputs, in which case they are emitted on output 1.

If you don't specify P, you must supply one of the SAMPLE and DROP keyword arguments.

Keyword arguments are:

  • SAMPLE P — Sets the sampling probability to P.
  • DROP Q — The element will drop packets with probability Q. Same as suppling (1 - Q) as the sampling probability.
  • ACTIVE — Boolean. RandomSample is active or inactive; when inactive, it sends all packets to output 0. Default is true (active).

ELEMENT HANDLERS

  • sampling_prob (read/write) — Returns or sets the sampling probability.
  • drop_prob (read/write) — Returns or sets the drop probability, which is 1 minus the sampling probability.
  • active (read/write) — Makes the element active or inactive.
  • drops (read-only) — Returns the number of packets dropped.

SEE ALSO

RandomBitErrors

Generated by click-elem2man from ../elements/standard/randomsample.hh:8 on 2017/10/17.

Clone this wiki locally