Improved the tensor random number generators:

* Use a mersenne twister whenebver possible instead of the default entropy source since the default one isn't very good at all.
 * Added the ability to seed the generators with a time based seed to make them non-deterministic.
This commit is contained in:
Benoit Steiner
2015-04-20 09:24:09 -07:00
parent 016c29f207
commit 43eb2ca6e1
2 changed files with 155 additions and 43 deletions

View File

@@ -53,8 +53,8 @@ class TensorBase<Derived, ReadOnlyAccessors>
}
template <typename RandomGenerator> EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseNullaryOp<RandomGenerator, const Derived>
random() const {
return nullaryExpr(RandomGenerator());
random(const RandomGenerator& gen = RandomGenerator()) const {
return nullaryExpr(gen);
}
// Generic unary operation support.