Documentation Set for Swarm 2.2
Prev | Reference V. Random Library | Next

# BernoulliDist

## Name

BernoulliDist -- Bernoulli Distribution

## Description

A distribution returning YES with a given probability.

## Protocols adopted by BernoulliDist

BooleanDistribution CREATABLE

## Methods

### Phase: Creating

- + create: (id <Zone>)aZone setGenerator: (id <SplitRandomGenerator>)splitGenerator setVirtualGenerator: (unsigned)vGen setProbability: (double)p
  Use this create message if the generator to be attached is a Split one:

- + create: (id <Zone>)aZone setGenerator: (id <SimpleRandomGenerator>)simpleGenerator setProbability: (double)p
  Use this create message if the generator to be attached is a Simple one:

### Phase: Setting

- - setProbability: (double)p
  The setProbability: method sets the probability of returning YES.

### Phase: Using

- - (BOOL)getSampleWithProbability: (double)p
  The getSampleWithProbability: returns a sample YES or NO value.

- - (double)getProbability
  The getProbability method returns the probability of returning YES.

Prev | Home | Next
BasicRandomGenerator | Up | BinomialDist