---
name: "PGARandomFlip"
section: "5"
platform: "linux"
package: "pgapack"
version: "1.1.1-3"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/PGARandomFlip/5"
---

# PGARandomFlip(5)

flip a biased coin and return PGA\_TRUE if the coin is a "winner."

## NAME

PGARandomFlip - flip a biased coin and return PGA\_TRUE if the coin is a "winner."

## DESCRIPTION

Otherwise, return PGA\_FALSE.

## INPUT PARAMETERS

- ctx

  \- context variable

- p

  \- biased probability (.5 is a fair coin)

## OUTPUT PARAMETERS

- none

  ## SYNOPSIS

```
#include "pgapack.h"
int  PGARandomFlip(ctx, p)
PGAContext *ctx
double p
```

## LOCATION

random.c

## EXAMPLE

```
Example:
To return PGA_TRUE approximately seventy percent of the time, use
PGAContext *ctx;
int p;
:
PGARandomFlip(ctx, 0.7)
```
