Marcel-Rodekamp / NSL

Nanosystem Simulation Library (NSL) implements statistical simulations for systems on the nanoscale
Other
2 stars 0 forks source link

Random Danger #159

Open evanberkowitz opened 10 months ago

evanberkowitz commented 10 months ago

There's a danger of confusion in the current way the random functions are named.

NSL::Tensor<Type> a = NSL::rand(4,4); // Unambiguous
NSL::Tensor<Type> a(4,4) = NSL::rand(4,4); // Allowed
Type b = NSL::Random::rand(); // Fine
NSL::Tensor<Type> a(4,4) = NSL::Random::rand();  // Really weird; a matrix where every element is random but equal.

The hope is to find a way to rename the random functions to avoid the last case unless the user explicitly is really clear about what they're getting.

Probably the best way is to rename eg.

NSL::rand --> NSL::Random::Tensor::uniform
NSL::randn --> NSL::Random::Tensor::gaussian (or normal)
NSL::Random::rand --> NSL::Random::Scalar::uniform
NSL::Random::randn --> NSL::Random::Scalar::gaussian (or normal)