Back to index

glibc  2.9
Defines | Functions | Variables
random.c File Reference
#include <bits/libc-lock.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define TYPE_0   0
#define BREAK_0   8
#define DEG_0   0
#define SEP_0   0
#define TYPE_1   1
#define BREAK_1   32
#define DEG_1   7
#define SEP_1   3
#define TYPE_2   2
#define BREAK_2   64
#define DEG_2   15
#define SEP_2   1
#define TYPE_3   3
#define BREAK_3   128
#define DEG_3   31
#define SEP_3   3
#define TYPE_4   4
#define BREAK_4   256
#define DEG_4   63
#define SEP_4   1
#define MAX_TYPES   5 /* Max number of types above. */

Functions

 __libc_lock_define_initialized (static, lock)
 weak_alias (weak_alias(__srandom, srandom)
 weak_alias (__initstate, initstate)
 weak_alias (__setstate, setstate)

Variables

static int32_t randtbl [DEG_3+1]
static struct random_data

Define Documentation

#define BREAK_0   8

Definition at line 103 of file random.c.

#define BREAK_1   32

Definition at line 109 of file random.c.

#define BREAK_2   64

Definition at line 115 of file random.c.

#define BREAK_3   128

Definition at line 121 of file random.c.

#define BREAK_4   256

Definition at line 127 of file random.c.

#define DEG_0   0

Definition at line 104 of file random.c.

#define DEG_1   7

Definition at line 110 of file random.c.

#define DEG_2   15

Definition at line 116 of file random.c.

#define DEG_3   31

Definition at line 122 of file random.c.

#define DEG_4   63

Definition at line 128 of file random.c.

#define MAX_TYPES   5 /* Max number of types above. */

Definition at line 135 of file random.c.

#define SEP_0   0

Definition at line 105 of file random.c.

#define SEP_1   3

Definition at line 111 of file random.c.

#define SEP_2   1

Definition at line 117 of file random.c.

#define SEP_3   3

Definition at line 123 of file random.c.

#define SEP_4   1

Definition at line 129 of file random.c.

#define TYPE_0   0

Definition at line 102 of file random.c.

#define TYPE_1   1

Definition at line 108 of file random.c.

#define TYPE_2   2

Definition at line 114 of file random.c.

#define TYPE_3   3

Definition at line 120 of file random.c.

#define TYPE_4   4

Definition at line 126 of file random.c.


Function Documentation

__libc_lock_define_initialized ( static  ,
lock   
)

Definition at line 198 of file random.c.

{
  __libc_lock_lock (lock);
  (void) __srandom_r (x, &unsafe_state);
  __libc_lock_unlock (lock);
}

Here is the call graph for this function:

weak_alias ( weak_alias __srandom,
srandom   
)

Definition at line 217 of file random.c.

{
  int32_t *ostate;

  __libc_lock_lock (lock);

  ostate = &unsafe_state.state[-1];

  __initstate_r (seed, arg_state, n, &unsafe_state);

  __libc_lock_unlock (lock);

  return (char *) ostate;
}

Here is the call graph for this function:

weak_alias ( __initstate  ,
initstate   
)

Definition at line 250 of file random.c.

{
  int32_t *ostate;

  __libc_lock_lock (lock);

  ostate = &unsafe_state.state[-1];

  if (__setstate_r (arg_state, &unsafe_state) < 0)
    ostate = NULL;

  __libc_lock_unlock (lock);

  return (char *) ostate;
}

Here is the call graph for this function:

weak_alias ( __setstate  ,
setstate   
)

Definition at line 278 of file random.c.

{
  int32_t retval;

  __libc_lock_lock (lock);

  (void) __random_r (&unsafe_state, &retval);

  __libc_lock_unlock (lock);

  return retval;
}

Here is the call graph for this function:


Variable Documentation

struct random_data [static]
Initial value:
  {


    .fptr = &randtbl[SEP_3 + 1],
    .rptr = &randtbl[1],



    .state = &randtbl[1],

    .rand_type = TYPE_3,
    .rand_deg = DEG_3,
    .rand_sep = SEP_3,

    .end_ptr = &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
}

Definition at line 161 of file random.c.

int32_t randtbl[DEG_3+1] [static]
Initial value:
  {
    TYPE_3,

    -1726662223, 379960547, 1735697613, 1040273694, 1313901226,
    1627687941, -179304937, -2073333483, 1780058412, -1989503057,
    -615974602, 344556628, 939512070, -1249116260, 1507946756,
    -812545463, 154635395, 1388815473, -1926676823, 525320961,
    -1009028674, 968117788, -123449607, 1284210865, 435012392,
    -2017506339, -911064859, -370259173, 1132637927, 1398500161,
    -205601318,
  }

Definition at line 147 of file random.c.