lundi 16 janvier 2017

How create a matrix filled with floats in range (n,n) in C++(Armadillo)?

I need to create a matrix containing random floating point numbers in range -0.1 and +0.1 in C++, any suggestion to how do this with a function (without using a for loop)? I use Armadillo library and i tried with randi(n_rows, n_cols, distr_param(a,b)) -that generates exactly what i need but with integers instead of floats- and with randu that generates random floats but only in the default range 0,1.

I'm new in C++ and i've learned coding basics with Python just few mounths ago. Thanks to anyone will help!




Aucun commentaire:

Enregistrer un commentaire