diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 455cbfddb..882d4a9c0 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -38,8 +38,8 @@ void basicStuff(const MatrixType& m) { VectorType v1 = VectorType::Random(rows), vzero = VectorType::Zero(rows); SquareMatrixType sm1 = SquareMatrixType::Random(rows, rows), sm2(rows, rows); - Scalar x = 0; - while (x == Scalar(0)) x = internal::random(); + Scalar x = internal::random(); + if (x == Scalar(0)) x = Scalar(1); Index r = internal::random(0, rows - 1), c = internal::random(0, cols - 1); diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index e5684a52f..80cf4c331 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp @@ -31,7 +31,7 @@ void linearStructure(const MatrixType& m) { MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols); Scalar s1 = internal::random(); - while (abs(s1) < RealScalar(1e-3)) s1 = internal::random(); + if (s1 == Scalar(0)) s1 = Scalar(1); Index r = internal::random(0, rows - 1), c = internal::random(0, cols - 1); diff --git a/test/nullary.cpp b/test/nullary.cpp index c2bbe3f4f..71cf9cbea 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -209,10 +209,7 @@ void testMatrixType(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - Scalar s1; - do { - s1 = internal::random(); - } while (abs(s1) < RealScalar(1e-5) && (!NumTraits::IsInteger)); + Scalar s1 = internal::random(); MatrixType A; A.setIdentity(rows, cols);