You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2010/09/20 00:34:26 UTC
svn commit: r998744 [2/2] - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/random/ site/xdoc/ site/xdoc/userguide/
test/java/org/apache/commons/math/random/
Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java?rev=998744&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java (added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java Sun Sep 19 22:34:26 2010
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.random;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Well19937cTest {
+
+ @Test
+ public void testReferenceCode() {
+ int[] base = {
+ 740849862, 1202665156, -199039369, -259008301, -291878969, -1164428990, -1565918811, 491009864,
+ -1883086670, 1383450241, 1244617256, 689006653, -1576746370, -1307940314, 1421489086, 1742094000,
+ -595495729, 1047766204, 1875773301, -1637793284, 1379017098, 262792705, 191880010, -251000180,
+ -1753047622, -972355720, 90626881, 1644693418, 1503365577, 439653419, 1806361562, 1268823869
+ };
+ int[] init = new int[624];
+ for (int i = 0; i < init.length; ++i) {
+ init[i] = base[i % base.length] + i;
+ }
+ Well19937c mt = new Well19937c(init);
+ int[] refInt = {
+ 2128528153, 327121884, 935445371, -83026433, -1041143083, 2084595880, -1073535198, -1678863790, -523636021, -1514837782, -736786810, 1527711112, -1051227939, 978703380, 410322163, 1727815703,
+ -648426354, 636056441, 1954420292, 17754810, -958628705, -1091307602, 1793078738, -1680336346, 1792171272, 941973796, -2066152330, -1248758068, -1061211586, 262020189, 1276960217, -233886784,
+ 1767509252, -1811939255, -406116097, -742435920, -1349799525, 240329556, -332161345, 1488943143, -332244280, 2093328957, 674753300, -1930135556, 257111467, 63793650, -1964335223, 1315849133,
+ -797349146, 1372022250, -1451892049, -1325138957, -870401239, -1294317369, 91490879, 386205044, -704074702, -1230679067, 1513674392, -262996240, 1196007314, 1398903796, 803719762, -1750926831,
+ -1268814180, 1233515404, 1498313934, -970591257, 611113671, -261632474, 1834097325, 1709440492, -150396854, 2120561003, -62645660, 479080234, 1535125050, 1823378695, -1129289329, -1095198399,
+ 2092564733, 78836308, -692015409, 1647147229, -1847922219, 1838279320, -848333841, -1375151778, 920238861, 1512628290, -749439404, 288851918, -427218675, 679640964, 425700808, -2077624511,
+ -1929434455, -647176419, 650437190, -1926749131, -1564744729, 734494454, 108193743, 246246679, 810042628, 1952337771, 1089253730, -1874275331, 1428419392, -492969232, 1945270770, -201265602,
+ -755490251, -624426214, -699605715, -113446478, 809091299, -1521531511, 1136505389, -523660964, 132928433, 1926559713, -1485314325, -508322506, 46307756, -1627479740, -589386406, -1855555892,
+ 584299545, 1272841066, -597242658, 925134545, 1102566453, -753335037, -9523218, -1778632375, 568963646, 764338254, 1259944540, -2000124642, 1307414525, -151384482, 807294400, 1993749511,
+ -15503094, -709471492, 2104830082, 1387684315, -1929056119, 224254668, -733550950, -889466978, -1987783335, -437144026, 995905753, -1021386158, -1096313388, -1014152835, -1303258241, 1201884788,
+ -1845042397, 1421462511, 980805867, 2143771251, 481226968, 1790544569, 328448328, 1995857639, -66668269, -1411421267, -222586606, 866950765, -308713926, -1048350893, 993222402, -1139265642,
+ -871837948, 1145571913, 381928580, 35386691, 1640961123, -1192981020, 775971009, 594246635, 1603197812, -575106766, 2023682000, -1636301903, -718093720, -1666421635, -2146115988, 320593570,
+ 287355418, 454400027, 1112753817, 1751196267, 782077910, -1478447368, -1007557264, -862315517, -2035355952, 2123515250, -557641502, -1789932035, 879640129, 44167603, 791148984, 1382939723,
+ -2135684233, 1825489580, 937345485, -1839983359, -1536880111, -1472578359, 1548052748, -1471535862, -14508727, 1509621398, -2134967452, -787485401, 815341660, -327905128, 1028096737, 866906991,
+ -1585990806, 859229080, 234806270, 998518056, -1897890815, -900923587, 1179856752, 1529572451, 620486106, 1119836556, 1661285564, 2097404633, -1437490790, 265306115, -984880135, 1326751968,
+ 1280043536, 680210701, 155786166, 1550973250, -325781949, -597789777, -1939780, 1345275487, 1930450001, 941449704, 669301309, 693651713, -990721514, 582968326, 976132553, -1892942099,
+ -1065070157, -711990993, -688974833, -1026091683, 1115346827, -1305730749, -1733626381, -364566696, -21761572, -37152746, -262011730, 1302722752, -1806313409, -767072509, 764112137, 1671157377,
+ 1837645038, -1021606421, -1781898911, -232127459, -310742675, -1818095744, -1128320656, -705565953, -354445532, -523172807, -433877202, 131904485, -64292316, 381829280, 229820263, 1797992622,
+ 1359665678, 978481451, -885267130, -1415988446, -356533788, -961419072, 1938703090, 708344111, 679299953, 744615129, 1328811158, 1257588574, 569216282, -753296151, -1519838713, 2016884452,
+ 1062684606, 1561736790, 2028643511, -1353001615, 886376832, 1466953172, 1664783899, 1290079981, -57483993, -1176112430, 1634916316, 1976304475, 1374136869, -648738039, 1058175869, -909000745,
+ -1526439218, 726626991, 2066596202, 64980943, -26166577, -885900005, -1821546816, -1103727665, 730606315, -1324948459, -696956940, -1300869403, 1171578314, 797249074, -1600611618, 1928247682,
+ 307164165, -1482476232, -1886179640, 1306433392, 1945271359, -1272113751, -1285984081, -2057145549, 795047465, 1262569087, -1239828121, 1426641636, -786371495, 2120199316, 1273690652, 74457589,
+ -1033394229, 338952565, 46122958, 1225741533, 2115308090, 678200841, -1618264885, -101162569, -1628976330, -1232839500, 468709044, 1876019116, 92723122, 233398255, -554960844, 38494196,
+ -406437278, 2083528643, -1106878615, -340722557, -2123964932, 223183343, 108918116, -1014629054, -901344544, -838896840, -1908460517, -1763508731, -926890833, 1703791049, -667755577, 1694418389,
+ 791641263, 1095689677, 1119202039, -1419111438, -2012259010, 188017439, -1775110395, -1971099661, -1688113734, 131472813, -776304959, 1511388884, 2080864872, -1733824651, 1992147495, 1119828320,
+ 1065336924, -1357606762, 462963503, 1180719494, -202678962, -892646595, 605869323, 1144255663, 878462678, -1051371303, 872374876, 631322271, -172600544, -1552071375, -1939570033, 151973117,
+ 1640861022, 310682640, 34192866, 2057773671, -2004476027, -1879238973, 582736114, 900581664, -427390545, -1232348528, -535115984, 1321853054, 69386780, -1729375922, 1418473715, 1022091451,
+ 496799289, -80757405, -1903543310, -1128846846, 1703964, 1984450945, 856753858, -812919184, 775486323, -1376056193, 638628840, 314243536, 1030626207, 644050997, 73923896, 362270613,
+ 236584904, 1463240891, -223614432, 435371594, -751940030, -124274553, -1991092884, 1579624267, 1249632649, 157589625, -345229739, -366245207, -1399995986, 1651729983, 1965074340, -1108970305,
+ 1163690769, 1732013523, -1461252895, 669755552, -476503675, -264578685, -32813949, 288222188, -25734262, 106040916, 1654395626, -365148479, 2014455846, -2040447994, 1351639280, -919975757,
+ -1970412139, -47306532, 222377665, -363434917, -1091717516, 2090685531, -1221091649, -1729649190, -1239406708, 1064945398, -105437479, -419675255, 74701669, -12862899, -498269844, 1566898997,
+ -1872838355, 1596887574, 485902962, 469225597, -881763553, 1307841032, -1642872487, 1388543045, 379792876, 1095683384, 840780732, 1934378038, 1851278350, -1359389423, 130868458, -313448799,
+ -663624816, 1031714153, -608443411, -205137499, -1849464427, 1973593637, 1068741808, -1420655961, 1188762305, 954044841, -995454462, -1818101092, -1937201943, -324541290, -1520603933, 572873173,
+ -554764496, 1051557081, -1245136076, -985349536, 329320398, 1787901464, -37803304, -1759310177, -1463492617, -1861729663, 1251768782, 256937091, -779036948, -2049893864, 1256022877, 1228075657,
+ -1550195255, -611319853, 1190797155, 2047604112, -576077160, -1532843331, -1324899394, -159729560, -622525946, -1080302767, -236033484, 1895243903, -410123689, -1944154157, -681781021, 1208453003,
+ 579595878, 1303914051, -145607082, -131567277, -1917288455, 894217359, -175688726, -1585480723, 663691440, -1140068263, -641711178, 1596080008, 629197693, 976422358, -1570451095, 525923776,
+ 895046136, -504151767, 1602553020, -1233054923, -1798474837, -1488857895, 1055782627, 261863143, 1879276655, 488240679, 1910982611, -1919441259, 370435945, 1265230086, -1293284428, -1503576227,
+ 2076963035, -1379628250, 1157098875, 1984461153, -1947837397, 1705880124, 1453607404, -1233649748, 1479943773, -863878721, -862415630, -736723275, 940306358, -1596000684, -1174889953, -615723892,
+ -885006597, -1796723178, 1844159055, -188942309, 2107251811, -1675486996, -1009475178, -859263556, -431866963, -9593673, -1878920923, -104853791, -1535224994, -69315537, 586690130, -1292234796,
+ 1378749456, -301873019, -319297563, 1677205851, 292450579, -1289441171, 1788113680, 1907606333, 1464711611, -1372023606, -1978832445, -1772259768, 1949124464, 1818322887, -1138036603, 1249727628,
+ -1474866449, -1868013169, -1384567593, 717007936, 954189997, -1900561040, 738470389, -158973180, 1732860784, 1936031206, -1133354740, -1173166665, 1432976712, 852636081, 1732064691, -1831788120,
+ 1273933579, 455403217, 1988395890, 106493468, 506092152, -610530423, 1698053512, 1311747476, 1969503012, -1887461759, 1613543073, 903200334, -737865837, 325656800, -1234001200, 1492148864,
+ 2009861533, -368262605, 1091338541, 2076108119, -961392337, 1835877112, 316250307, -853333391, -2125443777, 815363504, -798707803, -158146540, 690786114, -530775684, 1203556940, 1611485582,
+ -1661412270, -53184506, 2126287444, -232222229, 1559486057, 283532250, 1202760418, 932144172, 1082594656, -570104011, 413509167, -995027177, -996477516, -540544, -745537167, -712135469,
+ -996294983, -592787198, 1889840948, 1314628747, -394266926, -682316577, 456447239, 1728806063, -396279614, -43387643, 1915717013, -861574144, -1078710588, -561401249, 1111464540, 63643984,
+ -1693870413, -968369980, -1053148188, 708799038, 1883537988, 373371671, -156410415, -1596483236, -1846890431, 888692915, -1025632583, -1666477591, -343066267, -2059058792, 641501628, -1744347292,
+ 1648632991, 1743540146, 2020952406, 164014499, 990508262, 1706408228, -1236471842, -347116260, 1843634523, 827255665, 300519853, -1265974830, -547247177, -583064554, -1995437077, 689210107,
+ -93151393, 835365056, 1706367315, -1605902756, 200954895, 431093688, -277573364, -928486713, -552221973, 145432789, 1128919795, 1675095586, 1930359882, 1215849501, -1447770583, 657776490,
+ 1885869860, -1629237204, -868897479, -1258169760, 1828140195, -883850439, 463933909, -347361158, 1478116648, 801176896, -1501915899, 1017335748, -1654508882, 123994786, 1588785290, 791166651,
+ -1523108535, 340411166, -496474762, -1189711141, -7392628, 2045171250, -1245366209, 834787230, -1346883181, 2034209454, 737043362, 898803323, 1983089087, -1845404320, 9585188, -1180608323,
+ 1665100606, 1949474222, -211115008, 1151308295, -2132174259, 913126312, -2085061672, 1419864120, -1134542954, -53833957, -246913211, 468382370, -1759479323, 1136686211, 1307012488, -2036299559,
+ -1346099736, 314743106, -1683101865, -947151948, -234529696, -2103334293, -279256894, -1484257, -1053953017, 1801205399, 941594454, -874119215, -672865187, 762284205, -1494975451, 486607927,
+ -898264389, -1711861093, -212572760, 2106484281, -1610786470, 1352525590, -837779586, 1568282001, -593019125, -1146260782, -1595879979, -640781858, 1107692311, 1547132709, -1928385535, -2057772805,
+ 634887038, 329772618, 942136006, -864405576, 501883884, 1537141484, -1180626836, 1123055420, 1090885851, 421662750, 2033111605, 1710917425, -1118058244, 74321279, 257328195, -1199940697,
+ 208625996, -442341447, 808119183, 1166827075, 1177417517, -1856155370, -1464837036, -60624923, -1306220638, -91104698, -1434621430, 548899241, 37351476, 1478278431, -1255061434, 248470035,
+ -104642597, -1865169521, 1418373655, -1660810523, -2129015436, 154612798, 276575732, 1930338442, 179503250, -929294855, -39452027, -1377657544, 1442322193, 1137511318, -432158653, -984801987,
+ 743099148, -1118893528, -904123623, -1273146363, -1884800406, -803169061, 1254123158, -484252077, 317646844, 404246525, -1230293916, 1121445742, -19657507, 652967153, -1055406692, -468950719,
+ -1493532921, -1447624258, -1369679689, -1517000228, -145853307, 1518006526, 1591195514, -1475557146, -909722097, 2103182976, -406830579, -2124025254, -1804819507, -1357512858, 567321869, 409048156,
+ 567805180, 1749009386, 1762759722, -1770324077, 1271140844, 468219092, 955792405, 1911965665, 1876314424, -718200715, -1278883927, 1392281730, -120519585, 851473793, 245054754, -33369039,
+ -284877584, -479534880, -212346563, -122017521, -1461429983, 1331007370, 1788621721, 1739036536, 1446350953, -1985448033, 685528610, -1386434659, 1368233993, 2021786790, 1596478397, -1716635278,
+ -2011083017, 171876097, -311529197, 687812052, 377000657, -1055547517, -1499047842, -1818434951, -120863666, 33888043, -1387509273, -541540700, 1162597745, -1331415338, 1931708792, -850270000,
+ 663845594, 1536495943, -322924971, -1380272203, 261190298, -204874428, -2104974031, 883819928, 155808204, -1454446035, 1323388464, -1696505728, 1549800285, 1018150463, -1327715703, -1582480640,
+ 1013659809, -1820360082, 1666498787, 1406120540, -196541482, 1248470531, -1250433281, 836375878, 177646854, -1927020253, 2145878321, 689712096, -596605921, 348283199, 1916993096, 481356808,
+ -339687826, 1219340319, 718895887, -2007521340, -1859185806, 2042164737, -58146784, 742449142, 1930754708, 780832111, 715056441, -1393886151, -8150527, -599607443, -537300865, -1212516084
+ };
+
+ for (int i = 0; i < refInt.length; ++i) {
+ Assert.assertEquals(refInt[i], mt.nextInt());
+ }
+
+ }
+
+}
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well19937cTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java?rev=998744&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java (added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java Sun Sep 19 22:34:26 2010
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.random;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Well44497aTest {
+
+ @Test
+ public void testReferenceCode() {
+ int[] base = {
+ 740849862, 1202665156, -199039369, -259008301, -291878969, -1164428990, -1565918811, 491009864,
+ -1883086670, 1383450241, 1244617256, 689006653, -1576746370, -1307940314, 1421489086, 1742094000,
+ -595495729, 1047766204, 1875773301, -1637793284, 1379017098, 262792705, 191880010, -251000180,
+ -1753047622, -972355720, 90626881, 1644693418, 1503365577, 439653419, 1806361562, 1268823869
+ };
+ int[] init = new int[1391];
+ for (int i = 0; i < init.length; ++i) {
+ init[i] = base[i % base.length] + i;
+ }
+ Well44497a mt = new Well44497a(init);
+ int[] refInt = {
+ -1464956854, -1524360321, 986845646, -182050548, -818943186, -1744848370, 1392434650, -182648505, -2026593838, 1254866610, -410459761, -1392048371, -968730026, 1485793687, -728749746, -112685463,
+ 275126404, -1101838984, 1193096287, 443511615, -510869213, 549869992, 1974458428, -1217587840, -335835016, -2048974745, 1066947099, -611611187, 1978925459, 688164478, -463344808, 56995910,
+ 699288809, 606392470, 117418673, 1948706703, -485598135, 385841705, 1725261146, -919553921, 70643668, 2128611684, 1720197347, 738706713, 1162026860, -611442152, 1469145601, 2051653750,
+ 609067755, -1971782890, -971114565, 776260144, 1619791127, -1547233838, 1502505722, 913168193, 1761269649, 81782996, 62251540, 1519079156, 1239007000, 489633356, -800433470, -2107278046,
+ 495320431, 269446836, -2013306553, 1074614697, 1645125348, 584369930, -405429577, 1211134012, -2060113546, -2047824, -443978800, 271218497, -1002185964, 1519315874, -695096464, -79101601,
+ -1521653608, 192426133, 1159511202, -1354494985, -477280535, 583522228, -661741458, -1251175621, -369487281, -2015449518, -2102058930, -645264919, -925270025, -1674575999, 1363844609, -831732660,
+ -1668989157, -1861246633, 83763283, -1056074975, -519054258, -1546386261, 1691674654, -885968657, -1189571815, 2095154843, 1686743191, -1859471265, -261593938, 1721982136, -491120252, -949699153,
+ 642525852, -2005306625, -1004765905, 742736856, 1653443876, 788423835, 1536155740, 879514143, -1510757104, 115238646, 28600662, 1485490803, 1272460710, 523153480, -766782926, 1332478031,
+ 528775440, 302965264, -2046891123, 1108139271, 1611601128, 550846467, -439082190, 1244786747, 941120547, -35568474, 1756370964, 304870369, 1902684028, -408710726, 1673189520, 1180987663,
+ -1488131864, 158973303, 154514890, -1387953397, 1453732833, -1342263302, -628153633, 4710424, 619931109, 721411332, -2135645486, 1688696681, -891749588, -1641122924, 1397432310, -865254619,
+ -1635468227, -1827787970, -1311416657, -1022618057, 1411688086, -1579840139, -637954674, 2115653281, -1155985079, -1043532593, -374286955, -1825883832, -227940643, 1688394137, -524577925, -983222470,
+ -1955769926, 626525757, -2009760930, -1855453635, -676923169, 754966926, -291202391, -2126042921, -1477304277, -1409345382, -1264640578, -441993991, -17611930, -1576809974, 2137694350, 1299022733,
+ -762509116, -1087399293, 819303572, -14571174, -719035481, -1644675278, 1492736905, -15038081, 974773023, 1087127339, 1790024863, -1493135734, 1936273291, -442361741, 1639666948, 1147532756,
+ 174955156, -1537685747, 187972574, 275303083, 1420277149, -1375787574, 1873043153, 38164241, 653451946, 687758113, 899667071, 1722219976, 2146668333, 587401069, -26582672, 2034645447,
+ 1401801794, 1043291001, -1277898614, 2116116828, 1445274301, 150534325, 469242183, -937704471, 171074779, -204638071, 1269913689, -771734064, -12280461, -1182158859, 1704390140, -263303749,
+ -848503723, -1822849148, -634064465, 1130988864, -1515750310, -908815400, 1487214333, 994482967, 853103628, 1711185413, 1520342001, 1067859186, 1693632130, -603831333, 292236742, -800655385,
+ -1467184928, 221125007, -1697377800, 1293953144, 1730537111, 1073329737, 519625212, 689636032, 1127394154, -1496469136, -1214585810, 822152197, -1572579275, -527866383, -996792678, -2058452887,
+ -1133767559, 576275042, 1579109209, -295089371, 1502267384, -724281876, -911879875, 1131096177, 333026744, 1238706603, 1067340063, -745697708, -973992204, 1560446744, -664017057, -616056490,
+ 1099714049, 674159948, 383625825, 1411443110, 1862818263, -1896254899, 1322476914, -719144734, -1540101945, 988154902, 781856577, 2013381051, -2059071359, -142073207, 60252832, 2052050421,
+ -666391497, 376633738, 1663011481, -1706886481, -1870003191, 1003819645, 898131216, 778824906, -656875645, -1730811011, -1751653787, 2056079904, 231977636, 1831419220, -465545074, -1505266471,
+ 1034419975, -133864043, 1876779821, 1879792902, -100100435, -959264741, -472668436, 203584096, -46980157, -1478047098, -979669209, 809008494, 1279644171, 2055793632, 1385672419, -1756428826,
+ -1790481031, -2089665073, -1608595011, 457322987, 1267418945, -19541848, -796352273, -1049973752, 30940894, -539710199, -1097391703, -779353550, -1328320498, -735447662, -918513196, 1516945649,
+ 1218919237, -251287485, 1826366637, 353082340, 889839220, 399638904, -1462573609, -618450466, 1429903706, 2095548034, 1486594475, -1053248922, 74346322, -357998703, 1790710495, -146359619,
+ 1581657509, -797737661, -920778913, 608399665, 646679359, 1861775150, -1014371223, 476735306, -1577737028, 383018939, 1234592859, 344770283, -472763155, 187217985, 1245828866, 1936329359,
+ 61243025, -1979390025, 903671173, 302699505, -1677126111, -1194113496, 835857595, 706998946, 70931462, 1374113464, -1464459699, -231081598, 1366205112, 396990527, -1615015619, -968458597,
+ 457632575, 24361353, -1120685182, 2101590608, 1654666456, -1208442054, 579414359, 1078056578, 217408674, -1560683025, 815178420, 1219326466, 450032327, 774403237, 54597342, -664057229,
+ 447132403, 50603973, 435640301, -1224073863, -1339908037, 1775470944, -1378119263, -1375189988, -1287971162, 29816317, -1313418882, -1824967031, 443540716, 11064217, -1463969487, 1967601549,
+ 124474667, 1230898256, -1741455555, 561643750, 933295231, -923145874, 245538199, 289478386, 200552280, -268887021, -1598221376, 1236123270, 318325803, 773964550, 191670680, 158043961,
+ -762639146, -416703928, -721969492, 1664330785, -584949010, 1509045840, -2066001147, 1728613092, -1103375821, -1262079070, -2034789427, -418216342, -546365126, 1235751589, 1639799329, 2085089663,
+ -697590049, -2007054256, -147701903, 209371702, -1868450893, 1241065116, 1537364837, -1035970557, 318040217, 150492098, 1841159805, -491979749, -1275490577, -1759443566, -697538216, -1589624976,
+ -678703557, -189067001, 1539472677, -1396089831, 271512148, 180483983, 483714313, 703861378, 2122114992, -600097045, 522009268, 160429181, -744428886, 1541223403, -1211039718, -1167643980,
+ 1551471162, -816207368, -1429258613, 1350901561, 1934120609, -961643277, -214772286, -2128270227, -1561239720, 1493926966, 1376671007, 94966082, 221846150, -164351411, -51309876, 497148497,
+ 1233668542, 266257753, -773473851, 953946385, 420815294, -1390653175, 1834391782, 4704447, -891751440, -744104272, -1082756642, 1431640408, -1912055536, -159789461, -704946016, 1956368139,
+ 642279822, -374415338, 1562655802, -272964020, 1071498305, 667364168, -1546405154, 341389690, 1360662999, 377696332, -437020076, -1668574556, 1242655350, -756555890, 645954261, 1914624235,
+ 2134904445, -247737098, 143667521, -17668806, 1804148531, 414247300, 1030053929, -1595215075, 887532426, 553113691, 1173830167, -303724353, -280418143, -1143962122, -1898518451, 36464746,
+ 1189572700, -1549967582, 1093341440, -452303819, -731023001, 1111173883, 1678013973, -836458212, -842956392, 212774049, -845621791, 966282353, -823130040, 700410571, 619075141, -304785045,
+ -1816233676, -1789653997, -166914694, 690663021, -669570330, 1098624444, -987380984, 452844935, -1089825546, 1221160503, 1217375341, 512281644, -1106887134, 1665404458, -1462594714, -207498587,
+ -789271490, -723469709, 512055365, 1445951882, 1692473633, -996873493, 1445046730, 993087194, -1666188562, -897427329, 1008869698, 1236029718, 1499207233, 1704947182, -1815799281, 686399988,
+ -475436580, 1588892458, 884859588, -471913926, -487416631, 1323960741, -1257612174, -468909314, -1866654496, -1417895838, 1707647971, 997140465, -1358794225, 1929422460, -605622778, -1587468566,
+ 469149623, 1121515927, 748484204, 1201983830, -1906623591, 76398473, 261109068, -796025669, -1964466661, 1739898262, -756850622, 1581369453, 1484675811, 484136467, -705983890, -1357931714,
+ 548520423, 741992908, 1017931838, -2078503520, 2097871343, 569233897, -91903627, 1864053450, -876129714, 336670307, -1950420274, -872316480, -662220291, 275724295, 703565412, 1334248646,
+ -217559198, 1044090753, 743502488, -1518545318, 20614180, -768582053, 976522354, -25129962, -983639284, 71722595, -119236393, 368844119, -795808244, 696073964, 1379765302, 235083623,
+ 666280330, -1313689346, -643870520, 534522699, -250414377, -1239276164, 159264592, -1119503518, 1168161619, -1366518946, -1335653301, 248092140, 1390152547, 2051602724, -1023547981, -1479782621,
+ -1785785862, 1609789158, -919124123, 1703200068, -852553456, 1573706142, -376011685, 305068766, -1231775451, -1536883494, -125122369, -896696968, 852651567, -458154391, 747781704, 1173040469,
+ -1569200836, 312506093, -1680530410, 117086271, 794587661, -1231003908, -1048955503, 2119305423, 1636729108, -522378372, 1627421730, 545077470, -1683264872, 1486496559, -1793064672, 1908368749,
+ -1226052295, 1399248776, -588193954, -1289386125, 534647065, 2126245059, -238362987, -1244573058, -1571832269, -2052693379, 1494767731, -528668449, -980826491, -151282847, -1468523556, 1876349941,
+ -301654558, 1467960576, -741720848, -612158589, 92376910, 987915105, 1037689578, 793773489, -1387669541, 349490139, 564784004, -1161242130, 619703053, 2063233129, 190888106, 81845991,
+ -1482466066, 283234313, 114355492, -1879406787, -1283370924, -1378903370, -730141747, 1570738286, -281348873, 2131743196, 795654462, -497365688, 437612465, 1928618254, 1433118279, -1801292119,
+ -2059248836, -221673230, 163637697, -411319468, 244353317, 786753178, 489172932, 464627154, 1258915212, -229028334, -994675463, 1931657329, 1784181437, -97111947, 1728952452, -1329133577,
+ -1606156362, 1341196121, 1679632329, -796545286, -1021125869, 1427825468, -214986389, 250791528, 1029777000, 90661677, 602529506, 2068040879, 1483801763, 2332097, -457467017, 672399614,
+ 1542769193, 1781253216, -1967165705, -2052227925, -1248173215, -1676554121, 292413596, 209649573, 1750689340, 1946874730, -832845570, 1774178655, -450175610, -431901779, 613330756, 1969434259,
+ 1251099237, -1320908513, -50659188, 273178515, -296290724, 1195998469, 1329813722, 759419114, 1003396150, -274557619, -548886303, -2055397788, -766678640, -464045978, -1835907569, -169406709,
+ 820751456, 1778613303, -1582073956, -1728391771, -2075389498, -1606584632, -1702107251, -15724560, 45610235, -1967510298, -671487775, -1841110041, -913365944, 869680052, -798103472, -1564096927,
+ -918899909, -810066882, 428829752, -1413487973, -844240890, 1343914280, -689285374, 1827745702, -799686631, 1696465705, -726159000, -1381157526, 1649221296, 1791106481, -1872852642, -485685063,
+ 1534949133, -1611901907, -581776031, 242740701, -382394666, 668419384, 388297992, 748818886, 713804061, -1783774172, -1823401590, -1009098384, 2071462929, 1154475522, 1309810666, -1734475040,
+ 1212095416, 988288210, -1457428115, 1699730041, -1804729443, -1922824494, 1000076038, -226555981, 131425181, -1071582828, 357680377, 1574190179, 996651958, 965704429, -47651768, 243931978,
+ 808955117, -652323633, 544967309, -1199510217, 702795379, 997685748, 1593927308, 2119371055, 1451401230, -41992913, 2033816081, -1030495962, 1764010175, 457470691, -2001190141, -373358035,
+ -1950331268, -1291674220, 642934467, -1825725718, -1555687487, 1664472129, -24722338, 1899539596, 78519318, 1662555805, 1744711308, -2142888582, -1597853572, 118030659, 1596713428, 404304267,
+ -1350880388, 648702031, 1185458591, 1798138033, 819516445, -1466759682, -751277607, -879817426, -1931050435, 1465603177, -1402344216, 768491239, -1404853657, -1915685264, -1845859847, 313163207,
+ 1239598382, 1988767047, -555152530, -1925665864, -182399255, -1392390808, 64861291, -511875035, 1879964459, 918905020, -840773616, 459610189, -1522352470, -1821396360, 977274705, -60616465,
+ -1846727880, 1208592937, -515359427, 1127607806, -395032287, 491869604, 2053794084, 568321750, 1597027438, 1355613070, -2069482724, 1899252555, 844726247, -625112193, 1146099491, -1037855139,
+ 1203928737, 1875686061, 994108281, 1471873396, 2026801570, 4941446, -1066074241, -983738686, 2037429697, -836521112, -633388883, 1221918725, 2137035208, -369891832, 372509548, -110916409,
+ 80517712, -658056946, 727893428, -1353651002, -475459562, -291323023, 1059377566, 591801919, 1018232602, -348255729, 1863827426, 246032476, -1026132864, -1356383176, -1224690998, 262442981,
+ 1257773681, -1738604660, 77131430, -1320261233, -2342727, -1817187590, -1883997191, 1367221809, -1863623746, -1132606249, 149024763, -1228275128, -578030399, 356914163, 2109691820, -880313621
+ };
+
+ for (int i = 0; i < refInt.length; ++i) {
+ Assert.assertEquals(refInt[i], mt.nextInt());
+ }
+
+ }
+
+}
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497aTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java?rev=998744&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java (added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java Sun Sep 19 22:34:26 2010
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.random;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Well44497bTest {
+
+ @Test
+ public void testReferenceCode() {
+ int[] base = {
+ 740849862, 1202665156, -199039369, -259008301, -291878969, -1164428990, -1565918811, 491009864,
+ -1883086670, 1383450241, 1244617256, 689006653, -1576746370, -1307940314, 1421489086, 1742094000,
+ -595495729, 1047766204, 1875773301, -1637793284, 1379017098, 262792705, 191880010, -251000180,
+ -1753047622, -972355720, 90626881, 1644693418, 1503365577, 439653419, 1806361562, 1268823869
+ };
+ int[] init = new int[1391];
+ for (int i = 0; i < init.length; ++i) {
+ init[i] = base[i % base.length] + i;
+ }
+ Well44497b mt = new Well44497b(init);
+ int[] refInt = {
+ -102003638, -1254584449, 836441550, 1949705484, 653000494, 1579400718, 699652570, -140738233, 1164288466, 419933874, 366568847, 780567309, 1867405910, -350557801, -964350642, -1323492759,
+ 191502468, 398676344, 1568976991, 1005053759, 199053603, 31083944, 74697788, -1343941248, -1205631880, -1637961625, 361813531, -1706096179, -403340909, 1666226814, -2034962600, 1237102662,
+ -1833248535, 1584255126, 1295661745, -1753848945, 1208145993, 930278953, -733716134, 192752767, 1692463060, 1727273316, 2122952931, -809025255, -992081044, -895539688, -419372543, -1835478922,
+ 2089629419, 1646590742, -1261083717, -1005462992, 1619627287, -1437723182, 1619689210, 1319393089, -1816963183, -150214444, -513482220, 1897815796, -1861960936, -1766444468, 2034653890, 585657634,
+ 1867016559, 696942260, -1536237241, -527055447, -1554805020, -1063992566, 1024799415, 1782080572, -1884276362, 129028272, 1427925968, -1154222271, -1383146732, -1580532830, -1907049616, -104299169,
+ -1780913000, -2090815339, -1789809502, -1521443849, 1226625769, 1126090676, -2117094290, -449575109, -218982833, -695554478, 35923022, 1386126825, -95031305, -168657023, 436674049, -1137917876,
+ -2045134053, -1025629865, 133144659, 64226081, -1966942130, 700813483, 344058910, -910646033, -212789479, 740360859, -1269028713, 1517763679, -664178514, -683718472, -71951996, 86583727,
+ -1235669348, -1426987265, -166598353, 214190040, -1436967644, 233824411, 710927452, -1939548641, -433607408, -1075939594, -1549702826, -1310827917, -640604762, -696863672, -1282162126, -546470833,
+ -1516734192, -513809904, -458526835, 708926727, -476643096, -2108375037, -2870478, -1460116421, 436587555, -948939610, 1891375124, 1944216545, 959034236, -1267038790, -1695098736, 1853748495,
+ 1594424552, 1270099319, 1139585482, 1837434635, -709909535, -457524230, -887118113, -241703912, -1888225819, -751575804, 1122280146, 1194255209, 949350188, 892826516, -791212042, -151203035,
+ -859297731, -1979039938, 323603119, -1022065097, -1804294506, -385802891, -2127523442, -720380255, -1315859127, 999649487, 335041941, -1732821688, -1833409827, 535715225, -1285355653, 1206723386,
+ -1141619270, 759796285, -1599504546, -1988521411, 1056668895, -852564594, 1056509609, -1831687977, 754168875, -1301144422, 922880446, -1502666503, -949791898, -1043870198, -1136941938, -1649670259,
+ 1342769348, 1692605059, -132279148, -1108038310, -14355545, -1611387086, 1651826569, 877600127, 1356160799, -759125205, -1300490081, -414938486, -201479285, 1958709363, 1513313540, -1396836908,
+ 1352702612, 1142506253, 52969438, -365142357, -1619054179, -1368514102, 1470750417, -1420830959, -843909462, -1679570143, 1447444607, 234551752, -1507452115, -1433234579, -680890000, -497305145,
+ 860408898, 263376761, 1537070218, -592353956, 1587852989, 1756653749, -2081320633, -1547020311, 723771611, -883819383, 1899879513, -268417584, 1058606451, 1665941493, -1630340612, -614737477,
+ 891313237, 1368950660, -1166187089, 296322368, -1908770726, -2120378408, 1245479677, 1879710487, -1705947124, 1018371589, -1715010575, -1096078094, -1749891454, 2130888667, 318647750, 554592231,
+ -489121568, -1809605233, -1697905160, -953926536, -2013960553, -148884919, 1822739964, -1466301760, 141999978, 1946526064, 1323036718, 864390149, -2141665227, 1510602225, 1468408474, 1277039721,
+ -1368096647, 180965986, 2140852057, -688071899, 819713016, -154385940, -1182972611, 1257224305, 1392607672, 1364245931, -1768434401, 323522132, -555278604, 474186520, -1178901665, -2137343658,
+ 1636421121, 1398987084, 1276656225, 1013316006, -955917865, -1537149363, -179145358, 342862050, 1172728007, 736300054, -1114656959, -1831840325, -1882353535, -442915191, -1206488416, -1818534411,
+ 25312311, 2100297098, -1562767719, 1762553519, -1853194231, -1152612739, -2020055792, -809572150, 848584579, -535789699, 1817604709, 1343773216, -602234204, 1739930964, -833790834, 501215449,
+ -730104057, 1217783189, -681773267, -611951354, 978387629, -1516811237, 974303980, -1389665696, 2091099075, -727528826, 2116026151, 271935854, 613242379, -2100429856, 190004963, -1629612570,
+ -1362888327, 175094223, -917873219, -2008308245, -401946815, 504218792, -1966525201, 4106248, 164895454, 226502921, 655865257, -610528718, 189428750, 1055978898, 17603028, 591024369,
+ 1127922501, -1546639293, 1994174637, -724136988, -673919372, -1665002120, -612145705, -793102882, -1904763558, 757565058, -2091240021, -2123324826, -1518702766, -802889839, -223045921, -1509216579,
+ 1195556261, 2079259971, -903969953, -1781800655, 1834950463, -956531922, -1152550807, -1116052662, -348802884, -1395330117, -91758501, -19115285, 1926930669, -1015793599, 545904386, 1617858191,
+ 716963473, 1917089719, -980914811, -212646927, -1634695647, -1857924568, -1462257477, 1273750178, 1060328454, -361604424, 867932749, 451213698, 405780152, 1165233215, 1877230909, 2103114395,
+ 1644330815, 1252998537, 1961603970, -1533101488, 1790456024, -38226118, -1306744489, 713676418, -1535871838, 1378109935, -338185548, 1647669762, -477465913, 203482277, -1949756706, -503326093,
+ -638704909, 320186309, -1435581459, 907446649, -77384645, 537368928, -335347295, -1912061924, 547819174, -225549827, 1089455486, 463516297, -240127764, -85895271, 2053179697, -287394931,
+ 921878827, -933362608, -1178670275, -1200942874, -672571265, 574422382, 1441734039, -1814493454, 165751640, -176907245, -1170992192, -2123252090, -1435971541, 1591853830, -885477992, -792847559,
+ 1359875286, 1038392904, -2027255124, 687291425, -165513490, 1391146576, -1387080955, 794663652, -807189965, 667820962, -545384499, -1371368854, -689031878, 1504805541, -752825823, -1920047745,
+ -1884874017, -350566320, -197152911, -181743050, -798415949, -915922276, 1790690149, -363997181, 1923116185, -1326427198, -1621079427, -1997440997, 1798118127, -2053110382, -159879848, -1286787216,
+ 1046436411, 1832030471, -389092059, 71686169, -76025260, 1914270607, 1854169353, 872157826, -1774323792, -575165717, -1919931724, 2051498109, -1176174934, -883578901, -1253047270, -1310573900,
+ 245466682, -1784824328, -1319912821, 1377340217, 1364313761, -408687373, 142333378, -1952335763, -1703126184, 316314678, 2030555423, 488640834, -1783293306, 2116925005, -428337460, -42966447,
+ -476226114, -325172903, -1690748475, 852791569, 26490302, 85251337, -1374975770, -376283969, 982639600, 595119792, 376403422, 1574509912, -1509664496, -1901241749, -59019104, 358566667,
+ 341667214, 184541206, -550950854, -1897143732, 1595753537, -1236127928, 2014297822, -2033179270, -669806121, -1927596980, 1010735700, -581795164, 1922398838, -1456743538, -1633813803, 323177707,
+ 2002098813, -2099067658, 277393729, -671911622, -384463053, 2028267908, 367391785, 1270052637, -172839030, -650486693, -831800809, -1255138113, -137512799, 1904317942, -8229811, 707361898,
+ -276859812, 50417442, 1487081728, 1577776181, 1994451303, 1237303035, -602016235, -1905218276, -1895725672, 1172978849, 801129953, -1819485071, -587985848, -2010386741, -1645226427, -850866837,
+ 816998708, 357665811, 1955856762, 1617902189, -1013761306, 146782652, 904185608, -500146809, 2085848310, 1917713975, -1823786899, 1994184748, 789196322, 1766857258, 1770685286, 58213029,
+ -1699628994, 346827379, -1274423227, -5079670, -193099487, 1020296939, -1795904054, -1951053094, -43782418, -375403393, 1026761026, -207269610, 1364563521, 1578793454, 457809423, -534138380,
+ -1052938788, -1897101526, 1449976516, 2052800058, -1145169719, 1476303269, 370625650, -325249282, 2165984, 1631432802, 1032336355, -1292978191, -1810172401, 725725820, -1162678778, 702624490,
+ 1387673527, 981825943, -556408212, -1108487850, -1782136935, 1582316425, -1752682164, 307235003, 1386486299, -1343636074, 1936875586, -1265279891, -345847069, 928241171, 239050350, 1859358526,
+ -664776217, -823267892, 346651710, -867656288, -1907921425, 1362445801, 541145461, -192727350, 1649366606, 244694627, -488180018, 214008256, 2032125437, -1678591993, -264593820, 1309017286,
+ -652451998, 1845366657, -703990120, -550186406, -630285276, 1782372955, 1650564210, -1127904234, -1407983860, -1119422877, -1565976361, -1913545385, 549841420, -1410323732, -1964467146, 228296551,
+ -421026422, 1929094398, -266906424, 264810315, -2008122665, -1088278148, 141242192, 1871293282, 234634067, 1724159838, 1638271051, -837713428, -657941661, 168093988, 708605363, -1881612509,
+ -1810496006, -193495322, 1889982309, -2050702012, -693694192, -1249780322, 718733403, -76349730, -188217051, 920912090, -1814078273, 2013358456, -1948845521, -198407575, -1248904632, 1182772565,
+ 1236791612, -1297489171, -1958468586, 1437011007, 390460941, 113068796, 1247982993, 2102889679, -1563524844, -128174212, -754095070, -1461699362, 943615640, -1013270737, 221253920, 1514140013,
+ 1596946745, 674222984, 616356702, 1811224435, -1764322023, -1653707581, -1702404459, 390678142, -209506765, -1398278531, -117061517, 1625861343, 659048069, -1490678943, 846536668, 210715637,
+ 1855458786, 1727745280, 1086729456, 1109111683, -985298098, -1813777567, -954599702, -1522494031, 1166103515, -191868965, -1048777852, -661271058, 1161457421, 1509090409, -919753558, -155431193,
+ -1774302994, -366390263, 2090138916, -693431491, -1693888428, 1846774454, 925855693, 474383470, 208889079, 382195164, -283005634, -2095134392, 579927985, 1390765326, -1766119865, 900457129,
+ -1503703236, 974952690, -107714111, 381338452, 1187256613, -860560742, 524103620, 1499506130, 197755276, -790802926, -406920967, -1972219791, -665721155, -113336203, 1037154436, -1185441801,
+ -745541706, -546274471, 1988928457, -1975403782, -1167172845, 777779004, -1560935061, -140258712, -1243598232, -1394149587, -785002782, 311842991, -1025469277, -605350463, -1251538057, 537203966,
+ 597777961, -1845767072, -1556349193, -1491015509, -1935936671, 2093498487, 1908270236, -315396187, 1356362300, -2025658518, 630119678, 276190559, 510123398, -1266145363, -170152124, -151540077,
+ -477900187, 1895894303, 1870333068, -1169891437, 353366620, 2111175941, 1691245786, 1318765802, -90993610, 921309517, 118241505, 367005284, 1624861072, 2010785894, 865255951, 1717799691,
+ -80757664, -644944841, 136999836, -341686875, -1908076090, -1968934200, -346397811, -184213520, -511811333, -2118173466, -1086490399, 1795322855, -635494328, 415716276, 851044432, -904636831,
+ -1972230341, -64337858, 571177016, 1248814747, -1351030778, 457872680, 1843549954, 1718960038, 815088665, 1812961065, 360686952, -1356586646, 1657802416, 1776192945, -786723490, -342254407,
+ -236653811, 771014701, 906386785, -308057635, 1907957462, 206000440, -42143480, 900403654, -917549795, -310520796, -1713627766, 2061136240, -377977839, 891282946, -821163030, 328143584,
+ 1503793080, 551621842, -2086273683, -2070526343, 91195293, -1654389038, -1035734266, -336619597, -1220221027, -1468468844, 2105626873, -841372573, -122707018, -2013073683, 494461000, -2054807734,
+ -67946259, 1914163407, 1941835405, -1027244745, -768123277, 419129844, -275750260, -171533009, 97756174, -17651409, -1578102255, 995291430, -1587462977, 692904675, 951632643, 1882101293,
+ -1546298756, 2018418068, -1790777661, 1542305514, -1437624383, 469587009, -1647853474, -1318279028, 497228822, 726733469, 1693133452, -2091185798, -209017732, 126386499, 1056958932, -2105494133,
+ 754067324, 96463951, 83701151, 1101658289, 1485852701, 553783806, 1898769881, -1072031442, 1438062141, 1992540265, 1152252136, 1019391719, -175951257, -6691216, 989789689, 968359367,
+ -1330392786, 1704963399, -998432914, -948060232, -1921688855, -975840920, 1360273515, -872810459, 12676907, -1908050756, 883609616, 65641549, -200365398, 1386653304, -1203665071, 1878689007,
+ 426262328, 315375145, 1900325181, 703658494, -765404895, 1070155172, 1399748900, -804264234, -1619419026, 1347225486, 230635292, 1093717835, 14020583, -2107039873, -968325341, -1679158691,
+ 1959784097, 1065690797, 1090615161, 1311445364, 865835426, 870016646, 574122879, 1842697922, -1289210431, -1914001560, 1672467629, -900366331, -1524066872, 136503816, -1910431892, -1431958329,
+ -830367152, -1316233970, -801974860, 1560669382, -81784810, 401822577, -949103202, 943897151, -722666726, -96825841, -1092898846, 230567004, -70355840, -1398069192, -312953142, 1475420133,
+ -622491023, 1661205388, -19071322, 6024591, 1473041593, 2053897978, -1346768903, 1484764721, -1552461890, 1287146711, 1613069307, 902497864, -1504480063, 375292915, -836353108, 2047602411
+ };
+
+ for (int i = 0; i < refInt.length; ++i) {
+ Assert.assertEquals(refInt[i], mt.nextInt());
+ }
+
+ }
+
+}
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well44497bTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java?rev=998744&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java (added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java Sun Sep 19 22:34:26 2010
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.random;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Well512aTest {
+
+ @Test
+ public void testReferenceCode() {
+ Well512a mt = new Well512a(new int[] {
+ 740849862, 1202665156, -199039369, -259008301, -291878969, -1164428990, -1565918811, 491009864,
+ -1883086670, 1383450241, 1244617256, 689006653, -1576746370, -1307940314, 1421489086, 1742094000
+ });
+ int[] refInt = {
+ 1634813289, 1876773016, -973836208, -2130023652, -1045460084, -1834384857, 1691032973, 609714289,
+ 2033920362, 555915483, 6680992, 1958127415, 1866469645, -1471336965, 2049178762, -192324811,
+ -2056050066, 810879705, 1405046309, -781317118, 1012782311, -1045081032, 728377508, 1473511660,
+ 290489070, 326666761, 2018299979, -1876688058, 1239968501, 1464625040, 2025151042, -101397407,
+ 1387902041, 210959839, 1366359326, -476473433, 153180037, -1607631523, -506743495, 17888738,
+ 313865008, -340504498, 586684079, 1243699375, 753162229, -646761694, -739189655, -210120185,
+ -1856358726, -628255542, -1812798197, 1416288088, 1077967722, -846846208, 1379850409, -580183344,
+ -1858959, 210859778, 295841424, 1492774865, -1415543680, -344870570, -1942779197, 1549510646,
+ -389544849, 314254218, 11784988, -1311757368, 1719514841, -764610517, 1296788970, -994707050,
+ 783854563, 422654144, 387639079, 1219688425, 2144352572, -834212874, -1036550358, 935909479,
+ -568610842, 1327498837, -588933178, 1910065754, -40851599, -182063170, 1302731458, 541311559,
+ -1647345522, 805224371, -1721196679, 1518507830, -952689880, -433276260, 509675254, -777259954,
+ 1277810106, 284054896, 936042202, 2036836351, 1956412426, -1186403024, 287795400, 2135311211,
+ 720485927, 1500695024, -281656583, -1277937322, -1628968482, 1242814831, -2030700974, 1473867890,
+ 440813549, -1357033971, 28384076, 1602731216, -641465746, -609054347, 635938444, 1472898176,
+ 1476894555, -747974186, -1590337055, -884242108, -389736197, -2066984505, 1087103272, -1236446290,
+ 31657463, 1835715432, -468439078, -2132633204, -434609235, 258308151, 1851926761, -1630139159,
+ -1344617241, 1969204215, 619463174, -174392624, 207475487, -1619828078, 1327980298, -83968178,
+ 445951782, -1786230541, 6279288, -580982231, 1550645552, 2006533941, 275746007, 455676647,
+ 2019637349, 1115547704, -1313120106, -516213449, 73752461, -1382448112, 398589620, 1319888048,
+ -1595572334, 1566934536, -1735685764, -1509545339, 1458173912, -549395819, -618827040, 1516624531,
+ 1900757187, -1454200688, 965524719, 488355065, -1869294316, -810641680, -2059428251, 1454656431,
+ 1329120541, -232185900, -994996943, 1855980910, -452077812, 1565630611, 759842266, 1241435187,
+ -1390456063, 1946400597, -2032319771, 683667881, 905911106, 1983310786, 120010546, 526018017,
+ -1946881912, 205004987, -1307250612, 2130980818, 2052864161, 189839787, 1789478047, 406168885,
+ -1145186347, 8507675, 1277188815, 1492619042, 2009819675, -1627411598, -851016743, -1828234956,
+ 1962622506, 2140398255, 236935165, -337237772, 1263419111, 516775236, -335741025, 1391328225,
+ 455979249, -1457534664, -657606241, 485648133, 1762116343, 1194889600, 817834937, 321150162,
+ 131159182, 290277758, -1876924740, -1770401129, 1291602973, -1003642974, -1580211929, 1520422021,
+ -399171579, -24315308, 453805396, -659197747, -205656847, 466526550, 1444397201, 1178091401,
+ -1157268826, -602394028, -1370668795, 1614896435, 1699071659, 1864753793, 1888518358, -1721244514,
+ 1812776767, 668822227, -297283057, 2130183333, -1169618692, 912860240, -2028253096, 1244694278
+ };
+
+ for (int i = 0; i < refInt.length; ++i) {
+ Assert.assertEquals(refInt[i], mt.nextInt());
+ }
+
+ }
+
+}
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/Well512aTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision