COSC-4P80-Assignment-2/lib/eigen-3.4.0/doc/special_examples/random_cpp11.cpp

15 lines
336 B
C++
Raw Permalink Normal View History

2024-10-21 16:42:03 -04:00
#include <Eigen/Core>
#include <iostream>
#include <random>
using namespace Eigen;
int main() {
std::default_random_engine generator;
std::poisson_distribution<int> distribution(4.1);
auto poisson = [&] () {return distribution(generator);};
RowVectorXi v = RowVectorXi::NullaryExpr(10, poisson );
std::cout << v << "\n";
}