File: surfrand.h

package info (click to toggle)
bglibs 2.04%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,468 kB
  • sloc: ansic: 15,821; perl: 674; sh: 63; makefile: 29
file content (31 lines) | stat: -rw-r--r-- 864 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef BGLIBS__SURFRAND__H__
#define BGLIBS__SURFRAND__H__

#include "surf.h"

/** \defgroup surfrand surfrand: Random number generator based on SURF
@{ */

/** The surfrand state structure */
struct surfrand
{
  /** counts the number of bytes in \c generated that have been output
   * already */
  unsigned left;
  /** temporary storage for the generated random data */
  uint32 generated[SURF_OUT_U32];
  /** the input seed data */
  uint32 seed[SURF_SEED_U32];
  /** a giant counter used as input to SURF */
  uint32 counter[SURF_IN_U32];
};

void surfrand_init(struct surfrand* c, const uint32* data, unsigned words);
uint32 surfrand_uint32(struct surfrand* c);
double surfrand_double(struct surfrand* c);
void surfrand_fill(struct surfrand* c, unsigned char* buf, unsigned len);
uint32 surfrand_uniform(struct surfrand* c, uint32 bound);

/** @} */

#endif