Faiss

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
faiss::RandomGenerator Struct Reference

random generator that can be used in multithreaded contexts More...

`#include <utils.h>`

## Public Member Functions
int | rand_int ()
| random 31-bit positive integer
long | rand_long ()
| random long < 2 ^ 62
int | rand_int (int max)
| generate random number between 0 and max-1 More...
float | rand_float ()
| between 0 and 1
double | rand_double ()
| RandomGenerator (long seed=1234)
| initialize
| RandomGenerator (const RandomGenerator &other)
| default copy constructor messes up pointer in rand_data

## Detailed Description

random generator that can be used in multithreaded contexts

Definition at line 49 of file utils.h.

## Member Function Documentation

int faiss::RandomGenerator::rand_int | ( | int | max | ) |

generate random number between 0 and max-1

The definition of random functions depends on the architecture:

- for Linux, we rely on re-entrant functions (random_r). This provides good quality reproducible random sequences.
- for Apple, we use rand_r. Apple is trying so hard to deprecate this function that it removed its definition form stdlib.h, so we re-declare it below. Fortunately, since it is deprecated, its prototype should not change much in the forerseeable future.

Unfortunately, system designers are more concerned with making the most unpredictable random sequences for cryptographic use, when in scientific contexts what acutally matters is having reproducible squences in multi-threaded contexts.

Definition at line 202 of file utils.cpp.

The documentation for this struct was generated from the following files:

- /data/users/matthijs/github_faiss/faiss/utils.h
- /data/users/matthijs/github_faiss/faiss/utils.cpp