World Ocean Simulation System (WOSS) library
uw-woss-random-generator.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 2025 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - WOSS@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
33#ifndef UNDERWATER_WOSS_RANDOM_GENERATOR_H
34#define UNDERWATER_WOSS_RANDOM_GENERATOR_H
35
36#include <memory>
38#include <rng.h>
39#include <tclcl.h>
40
41
43
44
45 public:
46
47
48 WossRandomGenerator( int seed = 0 );
49
50
52
54
56
58
59
60 virtual ~WossRandomGenerator() override = default;
61
62
63 virtual std::unique_ptr<woss::RandomGenerator> create( int s ) const override { return std::make_unique<WossRandomGenerator>(s); }
64
65 virtual std::unique_ptr<woss::RandomGenerator> clone() const override { return std::make_unique<WossRandomGenerator>(*this); }
66
67 virtual double getRand() const;
68
69 virtual int getRandInt() const;
70
71 virtual void initialize();
72
73
74 protected:
75
76 std::unique_ptr<RNG> rng = nullptr;
77
78};
79
80
81class WossRandomGeneratorTcl : public WossRandomGenerator, public TclObject {
82
83
84 public:
85
86
88
89 virtual ~WossRandomGeneratorTcl() override = default;
90
91
92 virtual int command(int argc, const char*const* argv) override;
93
94
95};
96
97
98#endif // UNDERWATER_WOSS_RANDOM_GENERATOR_H
99
Definition uw-woss-random-generator.h:81
virtual ~WossRandomGeneratorTcl() override=default
WossRandomGeneratorTcl()
Definition uw-woss-random-generator.cpp:87
virtual int command(int argc, const char *const *argv) override
Definition uw-woss-random-generator.cpp:104
Definition uw-woss-random-generator.h:42
virtual std::unique_ptr< woss::RandomGenerator > create(int s) const override
Definition uw-woss-random-generator.h:63
WossRandomGenerator & operator=(const WossRandomGenerator &copy)
Definition uw-woss-random-generator.cpp:49
std::unique_ptr< RNG > rng
Definition uw-woss-random-generator.h:76
virtual int getRandInt() const
Definition uw-woss-random-generator.cpp:78
virtual ~WossRandomGenerator() override=default
virtual std::unique_ptr< woss::RandomGenerator > clone() const override
Definition uw-woss-random-generator.h:65
virtual void initialize()
Definition uw-woss-random-generator.cpp:58
virtual double getRand() const
Definition uw-woss-random-generator.cpp:69
WossRandomGenerator & operator=(WossRandomGenerator &&tmp)=default
WossRandomGenerator(WossRandomGenerator &&tmp)=default
woss::RandomGenerator class
Definition random-generator-definitions.h:45
int seed
Definition random-generator-definitions.h:118
Definitions and library for woss::RandomGenerator class.