]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use platform independent random numbers. 14670/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 12 Jan 2023 15:59:09 +0000 (08:59 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 12 Jan 2023 15:59:09 +0000 (08:59 -0700)
tests/grid/reference_cell_type_04.cc
tests/grid/reference_cell_type_04.output

index 07e13e9ae864830655e3eb3b395668b36c2b6405..07c69f4b442c1694e04cbd6cae2bc40c3b4e1089 100644 (file)
@@ -35,16 +35,13 @@ test(const ReferenceCell &reference_cell)
   unsigned int       n_samples_inside = 0;
   const unsigned int n_samples        = 200000;
 
-  std::uniform_real_distribution<> uniform_distribution(-1., 1.);
-  std::mt19937                     rng;
-
   for (unsigned int n = 0; n < n_samples; ++n)
     {
       // Choose a random point in the box [-1,1]^d that contains all
       // of our reference cells:
       Point<dim> p;
       for (unsigned int d = 0; d < dim; ++d)
-        p[d] = uniform_distribution(rng);
+        p[d] = random_value<double>(-1, 1);
 
       if (reference_cell.contains_point(p))
         ++n_samples_inside;
index 8eadf35e7df1430d4d9e3cd529f7f34003eca477..be3b60bd18e52ed2e8d4c23c2bc1890d42aa6551 100644 (file)
@@ -1,22 +1,22 @@
 
 DEAL:1D::ReferenceCell: Line
 DEAL:1D::  self-reported volume = 1.00000
-DEAL:1D::  computed approximate volume = 1.00091
+DEAL:1D::  computed approximate volume = 1.00076
 DEAL:2D::ReferenceCell: Quad
 DEAL:2D::  self-reported volume = 1.00000
-DEAL:2D::  computed approximate volume = 0.998800
+DEAL:2D::  computed approximate volume = 1.00358
 DEAL:2D::ReferenceCell: Tri
 DEAL:2D::  self-reported volume = 0.500000
-DEAL:2D::  computed approximate volume = 0.498940
+DEAL:2D::  computed approximate volume = 0.497740
 DEAL:3D::ReferenceCell: Tet
 DEAL:3D::  self-reported volume = 0.166667
-DEAL:3D::  computed approximate volume = 0.166560
+DEAL:3D::  computed approximate volume = 0.169240
 DEAL:3D::ReferenceCell: Pyramid
 DEAL:3D::  self-reported volume = 1.33333
-DEAL:3D::  computed approximate volume = 1.33892
+DEAL:3D::  computed approximate volume = 1.34152
 DEAL:3D::ReferenceCell: Wedge
 DEAL:3D::  self-reported volume = 0.500000
-DEAL:3D::  computed approximate volume = 0.496800
+DEAL:3D::  computed approximate volume = 0.499080
 DEAL:3D::ReferenceCell: Hex
 DEAL:3D::  self-reported volume = 1.00000
-DEAL:3D::  computed approximate volume = 0.994000
+DEAL:3D::  computed approximate volume = 1.00820

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.