bm::random_subset< BV > Class Template Reference
BitMagic Library » bvector<> container » bvector<> algorithms

`#include <bmrandom.h>`

## Public Types

typedef BV | bvector_type
typedef BV::size_type | size_type

## Public Member Functions

| random_subset ()
| ~random_subset ()
void | sample (BV &bv_out, const BV &bv_in, size_type sample_count)
| Get random subset of input vector.

## Detailed Description

template<class BV>
class bm::random_subset< BV >

Class implements algorithm for random subset generation.

Implemented method tries to be fair, but doesn't guarantee true randomeness or absense of bias.

Performace note: Class holds temporary buffers and variables, so it is recommended to re-use instances over multiple calls.

Examples
  sample10.cpp, xsample03.cpp, and xsample07a.cpp.

Definition at line 56 of file bmrandom.h.

## Member Typedef Documentation

## bvector_type

template<class BV>

typedef BV bm::random_subset< BV >::bvector_type

Definition at line 59 of file bmrandom.h.

## size_type

template<class BV>

typedef BV::size_type bm::random_subset< BV >::size_type

Definition at line 60 of file bmrandom.h.

## Constructor & Destructor Documentation

## random_subset()

template<class BV>

bm::random_subset< BV >::random_subset | ( |  | ) |

Definition at line 128 of file bmrandom.h.

References bm::set_block_size.

## ~random_subset()

template<class BV>

bm::random_subset< BV >::~random_subset | ( |  | ) |

Definition at line 134 of file bmrandom.h.

## Member Function Documentation

## sample()

template<class BV>

void bm::random_subset< BV >::sample | ( | BV & | bv_out,
|  | const BV & | bv_in,
|  | size_type | sample_count )

Get random subset of input vector.

Parameters

  bv_out | - destination vector
  bv_in | - input vector
  sample_count | - number of bits to pick

Examples
  sample10.cpp, xsample03.cpp, and xsample07a.cpp.

Definition at line 140 of file bmrandom.h.

Referenced by compute_and_sim(), compute_random_clusters(), CSeqClusters::elect_leaders(), generate_random_subset(), and main().

The documentation for this class was generated from the following file:

- bmrandom.h