source: git/factory/cf_random.h @ d38762

fieker-DuValspielwiese
Last change on this file since d38762 was b52d27, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: more docu changes
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_CF_RANDOM_H
4#define INCL_CF_RANDOM_H
5
6// #include "config.h"
7
8#include "canonicalform.h"
9
10/*BEGINPUBLIC*/
11
12/**
13 * virtual class for random element generation
14**/
15class CFRandom {
16public:
17    virtual ~CFRandom() {}
18    virtual CanonicalForm generate() const { return 0; }
19    virtual CFRandom * clone() const { return new CFRandom(); }
20};
21
22/**
23 * generate random elements in GF
24**/
25class GFRandom : public CFRandom
26{
27public:
28    GFRandom() {};
29    ~GFRandom() {}
30    CanonicalForm generate() const;
31    CFRandom * clone() const;
32};
33
34/**
35 * generate random elements in F_p
36**/
37class FFRandom : public CFRandom
38{
39public:
40    FFRandom() {}
41    ~FFRandom() {}
42    CanonicalForm generate() const;
43    CFRandom * clone() const;
44};
45
46/**
47 * generate random integers
48**/
49class IntRandom : public CFRandom
50{
51private:
52    int max;
53public:
54    IntRandom();
55    IntRandom( int m );
56    ~IntRandom();
57    CanonicalForm generate() const;
58    CFRandom * clone() const;
59};
60
61/**
62 * generate random elements in F_p(alpha)
63**/
64class AlgExtRandomF : public CFRandom {
65private:
66    Variable algext;
67    CFRandom * gen;
68    int n;
69    AlgExtRandomF();
70    AlgExtRandomF( const Variable & v, CFRandom * g, int nn );
71    AlgExtRandomF& operator= ( const AlgExtRandomF & );
72public:
73    AlgExtRandomF( const AlgExtRandomF & );
74    AlgExtRandomF( const Variable & v );
75    AlgExtRandomF( const Variable & v1, const Variable & v2 );
76    ~AlgExtRandomF();
77    CanonicalForm generate() const;
78    CFRandom * clone() const;
79};
80
81class CFRandomFactory {
82public:
83    static CFRandom * generate();
84};
85
86/// random integers with abs less than n
87int factoryrandom( int n );
88
89/// random seed initializer
90void factoryseed( int s );
91
92/*ENDPUBLIC*/
93
94#endif /* ! INCL_CF_RANDOM_H */
Note: See TracBrowser for help on using the repository browser.