PSCF v1.4.0
CpuVecRandom.h
1#ifndef PSCF_CPU_VEC_RANDOM_H
2#define PSCF_CPU_VEC_RANDOM_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11// Forward declarations
12namespace Util {
13 class Random;
14 template <typename T> class Array;
15}
16
17namespace Pscf {
18
19 using namespace Util;
20
38 {
39
40 public:
41
46
53
57 virtual ~CpuVecRandom();
58
64 void associate(Util::Random& random);
65
71 void uniform(Array<double>& data);
72
80 void uniform(Array<double>& data, double min, double max);
81
89 void normal(Array<double>& data, double stddev, double mean = 0.0);
90
91 private:
92
94 Util::Random* randomPtr_;
95
96 };
97
98 #if 0
99 /*
100 * Returns value of random seed (private member variable idum)
101 */
102 inline long CpuVecRandom::seed()
103 { return randomPtr_->seed(); }
104 #endif
105
106}
107#endif
void normal(Array< double > &data, double stddev, double mean=0.0)
Generate normal-distributed random doubles.
void associate(Util::Random &random)
Create an association with a Util::Random scalar RNG.
CpuVecRandom()
Default constructor.
virtual ~CpuVecRandom()
Destructor.
void uniform(Array< double > &data)
Generate uniform random doubles in (0, 1].
Array container class template.
Definition Array.h:40
Random number generator.
Definition Random.h:47
long seed()
Returns value of random seed (private member variable seed_).
Definition Random.h:278
PSCF package top-level namespace.
Utility classes for scientific computation.