openGPMP
Open Source Mathematics Package
Functions
random.cpp File Reference
#include "../../include/nt/random.hpp"
#include <cstdint>
#include <iostream>
#include <random>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 6 of file random.cpp.

6  {
7  // generates a random 32 bit unsigned integer using a linear
8  // congruential generator (LCG)
10  6364136223846793005ULL,
11  1442695040888963407ULL);
12 
13  uint64_t res = gen();
14 
15  std::cout << "Random value: " << res << std::endl;
16 
17  static std::linear_congruential_engine<uint64_t,
18  6364136223846793005ULL,
19  1442695040888963407ULL,
20  std::numeric_limits<uint64_t>::max()>
21  engine;
22 
23  // Get the next random number from the engine
24  uint64_t std_lcg_res = static_cast<unsigned int>(engine());
25 
26  std::cout << "Random value: " << std_lcg_res << std::endl;
27 
28  return 0;
29 }
Linear Congruential Generator.
Definition: random.hpp:82

References python.linalg::res.