From: asl Date: Mon, 19 Oct 2015 05:28:22 +0000 (+0300) Subject: linear congruent method is applied for random numbers X-Git-Tag: v1.5~96 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa39ae89d44e1364f7c8a01562db48c47bf04cb0;p=modules%2Fhydro.git linear congruent method is applied for random numbers --- diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 1a5e0bf9..0d9a6668 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -67,7 +67,8 @@ Handle(AIS_InteractiveContext) context() QColor randomColor() { - int aHue = rand()%255; + int r = test_rand(); + int aHue = r%255; QColor aColor = QColor::fromHsl( aHue, 255, 128 ); return aColor; } @@ -95,7 +96,7 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, context()->EraseAll(); myKey = theKey; - test_srand( qHash( theKey ) ); + test_srand( 0 ); if( theShape.ShapeType()==TopAbs_COMPOUND ) { TopoDS_Iterator anIt( theShape ); diff --git a/src/HYDRO_tests/random.cxx b/src/HYDRO_tests/random.cxx index c0f11572..c829b20a 100644 --- a/src/HYDRO_tests/random.cxx +++ b/src/HYDRO_tests/random.cxx @@ -1,18 +1,15 @@ #include -quint32 m_w = 1; -quint32 m_z = 1; +quint32 next = 1; void test_srand( quint32 theValue ) { - m_w = theValue + 1; - m_z = theValue / 2; + next = theValue + 1; } quint32 test_rand() { - m_z = 36969 * (m_z & 65535) + (m_z >> 16); - m_w = 18000 * (m_w & 65535) + (m_w >> 16); - return (m_z << 16) + m_w; /* 32-bit result */ + next = next * 1103515245 + 12345; + return next % ( 1 << 24 ); } diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png index 86bdba35..f19fb736 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png index 8a4f4298..aac1e901 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png index f8529e51..86d933df 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png index 2ed3c282..4f1b80a8 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png index 1a2e977b..42f8dc1d 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png differ diff --git a/src/HYDRO_tests/reference_data/_cs13.png b/src/HYDRO_tests/reference_data/_cs13.png index 4ff74db6..c107613d 100644 Binary files a/src/HYDRO_tests/reference_data/_cs13.png and b/src/HYDRO_tests/reference_data/_cs13.png differ diff --git a/src/HYDRO_tests/reference_data/_cs23.png b/src/HYDRO_tests/reference_data/_cs23.png index 4ff74db6..c107613d 100644 Binary files a/src/HYDRO_tests/reference_data/_cs23.png and b/src/HYDRO_tests/reference_data/_cs23.png differ diff --git a/src/HYDRO_tests/reference_data/cs11.png b/src/HYDRO_tests/reference_data/cs11.png index 748b4ba6..9b5b4239 100644 Binary files a/src/HYDRO_tests/reference_data/cs11.png and b/src/HYDRO_tests/reference_data/cs11.png differ diff --git a/src/HYDRO_tests/reference_data/cs11_c.png b/src/HYDRO_tests/reference_data/cs11_c.png index 37422ebb..35057305 100644 Binary files a/src/HYDRO_tests/reference_data/cs11_c.png and b/src/HYDRO_tests/reference_data/cs11_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs12.png b/src/HYDRO_tests/reference_data/cs12.png index 57c99a94..eb5de694 100644 Binary files a/src/HYDRO_tests/reference_data/cs12.png and b/src/HYDRO_tests/reference_data/cs12.png differ diff --git a/src/HYDRO_tests/reference_data/cs12_c.png b/src/HYDRO_tests/reference_data/cs12_c.png index 8358bee8..26ce53c0 100644 Binary files a/src/HYDRO_tests/reference_data/cs12_c.png and b/src/HYDRO_tests/reference_data/cs12_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs13.png b/src/HYDRO_tests/reference_data/cs13.png index 36ed1426..90b9e45b 100644 Binary files a/src/HYDRO_tests/reference_data/cs13.png and b/src/HYDRO_tests/reference_data/cs13.png differ diff --git a/src/HYDRO_tests/reference_data/cs14.png b/src/HYDRO_tests/reference_data/cs14.png index 04cdf623..51d20ccc 100644 Binary files a/src/HYDRO_tests/reference_data/cs14.png and b/src/HYDRO_tests/reference_data/cs14.png differ diff --git a/src/HYDRO_tests/reference_data/cs14_c.png b/src/HYDRO_tests/reference_data/cs14_c.png index 4ff74db6..c107613d 100644 Binary files a/src/HYDRO_tests/reference_data/cs14_c.png and b/src/HYDRO_tests/reference_data/cs14_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs21.png b/src/HYDRO_tests/reference_data/cs21.png index 748b4ba6..9b5b4239 100644 Binary files a/src/HYDRO_tests/reference_data/cs21.png and b/src/HYDRO_tests/reference_data/cs21.png differ diff --git a/src/HYDRO_tests/reference_data/cs21_c.png b/src/HYDRO_tests/reference_data/cs21_c.png index 37422ebb..35057305 100644 Binary files a/src/HYDRO_tests/reference_data/cs21_c.png and b/src/HYDRO_tests/reference_data/cs21_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs22.png b/src/HYDRO_tests/reference_data/cs22.png index 57c99a94..eb5de694 100644 Binary files a/src/HYDRO_tests/reference_data/cs22.png and b/src/HYDRO_tests/reference_data/cs22.png differ diff --git a/src/HYDRO_tests/reference_data/cs22_c.png b/src/HYDRO_tests/reference_data/cs22_c.png index 8358bee8..26ce53c0 100644 Binary files a/src/HYDRO_tests/reference_data/cs22_c.png and b/src/HYDRO_tests/reference_data/cs22_c.png differ diff --git a/src/HYDRO_tests/reference_data/cs23.png b/src/HYDRO_tests/reference_data/cs23.png index 36ed1426..90b9e45b 100644 Binary files a/src/HYDRO_tests/reference_data/cs23.png and b/src/HYDRO_tests/reference_data/cs23.png differ diff --git a/src/HYDRO_tests/reference_data/cs24.png b/src/HYDRO_tests/reference_data/cs24.png index 04cdf623..51d20ccc 100644 Binary files a/src/HYDRO_tests/reference_data/cs24.png and b/src/HYDRO_tests/reference_data/cs24.png differ diff --git a/src/HYDRO_tests/reference_data/cs24_c.png b/src/HYDRO_tests/reference_data/cs24_c.png index 4ff74db6..c107613d 100644 Binary files a/src/HYDRO_tests/reference_data/cs24_c.png and b/src/HYDRO_tests/reference_data/cs24_c.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 876f052f..d9923b80 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -159,7 +159,7 @@ void test_HYDROData_LandCoverMap::test_incomplete_split() CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Split_2" ); - TestViewer::show( aWire, 0, true, Qt::blue ); + TestViewer::show( aWire, 0, true, Qt::green ); CPPUNIT_ASSERT_IMAGES HYDROData_LandCoverMap::Iterator anIt( aMap );