Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# rand.hh File Reference

A C++ interface for GRand. More...

`#include <xfc/object.hh>`
`#include <glib/grand.h>`
`#include <vector>`
`#include <xfc/glib/inline/rand.inl>`

## Namespaces

- namespace Xfc
- namespace Xfc::G

## Classes

- class Xfc::G::Rand
    A GRand C++ wrapper interface. More...

## Random Number Methods

- void random_set_seed (unsigned int seed)
    Sets the seed for the global random number generator, which is used by the G::random_* methods, to seed.
- bool random_boolean ()
    Gets a random boolean value (this corresponds to a unbiased coin toss).
- unsigned int random_int ()
    Gets a random unsigned integer equally distributed over the range [0..2^32-1].
- int random_int_range (int begin, int end)
    Gets a random integer equally distributed over the range [begin..end-1].
- double random_double ()
    Gets a random double equally distributed over the range [0..1).
- double random_double_range (double begin, double end)
    Gets a random double equally distributed over the range [begin..end).

## Detailed Description

A C++ interface for GRand.

Provides Rand, pseudo-random number generator.

## Function Documentation

bool random_boolean | ( |  | ) |

Gets a random boolean value (this corresponds to a unbiased coin toss).

Returns:
  A random bool value.

double random_double | ( |  | ) |

Gets a random double equally distributed over the range [0..1).

Returns:
  A random number.

double random_double_range | ( | double | begin,
|  | double | end
| ) |

Gets a random double equally distributed over the range [begin..end).

Parameters:

  | begin | The lower closed bound of the interval.
  | end | The upper open bound of the interval.

Returns:
  A random number.

unsigned int random_int | ( |  | ) |

Gets a random unsigned integer equally distributed over the range [0..2^32-1].

Returns:
  A random number.

int random_int_range | ( | int | begin,
|  | int | end
| ) |

Gets a random integer equally distributed over the range [begin..end-1].

Parameters:

  | begin | The lower closed bound of the interval.
  | end | The upper open bound of the interval.

Returns:
  A random number.

void random_set_seed | ( | unsigned int | seed | ) |

Sets the seed for the global random number generator, which is used by the G::random_* methods, to seed.

Parameters:

  | seed | A value to reinitialize the global random number generator.

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3