My Project
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
cf_random.cc File Reference
#include "config.h"
#include <time.h>
#include "cf_assert.h"
#include "cf_defs.h"
#include "cf_random.h"
#include "ffops.h"
#include "gfops.h"
#include "imm.h"
#include <flint/flint.h>

Go to the source code of this file.

Data Structures

class  RandomGenerator
 

Functions

int factoryrandom (int n)
 random integers with abs less than n More...
 
void factoryseed (int s)
 random seed initializer More...
 

Variables

GLOBAL_VAR flint_rand_t FLINTrandom
 
INST_VAR RandomGenerator ranGen
 

Function Documentation

◆ factoryrandom()

int factoryrandom ( int  n)

random integers with abs less than n

Definition at line 180 of file cf_random.cc.

181{
182 if ( n == 0 )
183 return (int)ranGen.generate();
184 else
185 return ranGen.generate() % n;
186}
INST_VAR RandomGenerator ranGen
Definition: cf_random.cc:66

◆ factoryseed()

void factoryseed ( int  s)

random seed initializer

Definition at line 189 of file cf_random.cc.

190{
191 ranGen.seed( s );
192
193#ifdef HAVE_FLINT
194 flint_randinit(FLINTrandom);
195#endif
196}
GLOBAL_VAR flint_rand_t FLINTrandom
Definition: cf_random.cc:25
void seed(int ss)
Definition: cf_random.cc:41
const CanonicalForm int s
Definition: facAbsFact.cc:51

Variable Documentation

◆ FLINTrandom

GLOBAL_VAR flint_rand_t FLINTrandom

Definition at line 25 of file cf_random.cc.

◆ ranGen

Definition at line 66 of file cf_random.cc.