monotone

monotone Mtn Source Tree

Root/randomizer.hh

1#ifndef __RANDOMIZER_HH__
2#define __RANDOMIZER_HH__
3
4// Copyright (C) 2006 Graydon Hoare <graydon@pobox.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13// This is just a set of utility methods built on top of boost::random.
14//
15// Our purpose is to create a global randomization utility for unit
16// tests. Nothing fancy.
17
18#include <stdlib.h>
19
20namespace randomizer
21{
22 // uniform process in [0,n]
23 size_t uniform(size_t n);
24
25 // boolean process with prob(true) = p, prob(false) = 1-p.
26 bool bernoulli(double p);
27
28 bool flip(size_t n = 2);
29};
30
31#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status