FV3 Bundle
oops/qg/model/random_f.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2018 UCAR
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #include "model/random_f.h"
9 #include <random>
10 
11 // -----------------------------------------------------------------------------
12 namespace qg {
13 // -----------------------------------------------------------------------------
14 
15 void random_f(const int & nn, double * xx) {
16  static std::mt19937 generator(7);
17  static std::normal_distribution<double> distribution(0.0, 1.0);
18 
19  for (int jj = 0; jj < nn; ++jj) xx[jj] = distribution(generator);
20 }
21 
22 // -----------------------------------------------------------------------------
23 
24 } // namespace qg
void random_f(const int &nn, double *xx)
The namespace for the qg model.