Skip to content

Commit d6cad53

Browse files
committed
use StableRNGs for random seed-dependent tests
- dbscan tests: refresh indices of reference clusters
1 parent 1d0a66a commit d6cad53

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
2424
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2525
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2626
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
27+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2728
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2829
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2930

3031
[targets]
31-
test = ["CodecZlib", "Statistics", "LinearAlgebra", "SparseArrays", "Distances", "Random", "DelimitedFiles", "Test"]
32+
test = ["CodecZlib", "Statistics", "LinearAlgebra", "SparseArrays", "Distances", "Random", "DelimitedFiles", "StableRNGs", "Test"]

test/dbscan.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,20 @@ end
4545
end
4646

4747
@testset "normal points" begin
48-
Random.seed!(0)
49-
p0 = randn(3, 1000)
50-
51-
Random.seed!(1)
52-
p1 = randn(3, 1000) .+ [3.0, 3.0, 0.0]
53-
54-
Random.seed!(2)
55-
p2 = randn(3, 1000) .+ [-3.0, -3.0, 0.0]
48+
p0 = randn(StableRNG(0), 3, 1000)
49+
p1 = randn(StableRNG(1), 3, 1000) .+ [3.0, 3.0, 0.0]
50+
p2 = randn(StableRNG(2), 3, 1000) .+ [-3.0, -3.0, 0.0]
5651

5752
points = [p0 p1 p2]
5853

59-
inds_1 = [1,2,3,5,8,9,10,12,15,16,17,19,20,24,25,26,33,34,35,36,37,38,39,40,43,45,46,49,50,55,56,58,59,68,69,72,74,75,76,77,78,79,82,84,85,87,88,92,95,96,97,98,99,100,102,103,105,107,110,112,115,116,117,120,121,130,137,138,144,145,147,148,149,151,153,155,157,158,159,160,163,164,165,166,167,168,169,173,174,175,176,180,183,188,189,191,193,194,197,198,200,201,202,205,206,207,209,211,216,219,220,222,224,225,228,233,235,236,241,243,247,249,250,252,253,254,258,261,262,265,268,269,271,272,273,274,279,280,284,285,288,289,291,297,302,303,304,306,307,309,310,315,317,318,321,322,326,329,331,332,336,337,338,340,341,343,348,349,354,356,358,360,361,362,364,367,370,372,375,380,382,384,396,397,398,399,403,404,408,409,411,415,417,422,423,425,427,429,432,435,437,438,446,449,450,452,453,454,458,459,460,465,466,467,468,469,470,473,474,476,478,480,484,489,490,494,497,499,506,508,512,516,517,519,521,522,525,526,529,531,532,534,537,538,540,543,544,548,551,554,557,558,560,561,562,563,568,572,573,576,577,579,586,588,598,604,605,606,607,609,615,618,622,624,626,629,632,634,635,638,639,640,641,644,648,650,652,654,657,658,660,662,663,664,665,667,671,674,676,677,678,679,682,688,690,691,692,693,695,696,697,699,700,708,710,711,714,715,716,717,719,723,724,725,726,729,735,736,737,738,740,741,744,747,748,750,751,753,757,758,759,760,761,766,767,772,776,778,779,780,781,783,784,785,788,789,791,792,793,794,795,796,798,802,804,806,807,808,809,812,816,818,820,822,823,826,828,830,831,833,835,836,837,838,847,851,854,855,856,857,858,860,862,867,868,869,870,876,877,878,880,881,882,883,888,890,892,895,897,900,901,903,905,907,909,912,913,914,915,916,918,921,924,925,926,928,930,931,932,936,938,939,940,941,943,946,950,951,954,956,958,962,963,965,968,969,970,973,974,975,976,982,985,986,988,989,990,992,994,996,998,1000,1882]
60-
inds_2 = [66,874,999,2005,2006,2007,2008,2012,2018,2020,2025,2032,2033,2035,2037,2039,2041,2043,2046,2047,2048,2051,2052,2053,2054,2059,2064,2065,2066,2067,2068,2069,2070,2072,2074,2076,2077,2080,2081,2082,2085,2088,2089,2090,2091,2092,2094,2096,2097,2100,2102,2103,2111,2117,2118,2119,2122,2127,2128,2130,2132,2134,2137,2138,2139,2140,2145,2151,2157,2158,2159,2163,2164,2165,2166,2171,2172,2173,2176,2177,2178,2179,2182,2186,2187,2191,2194,2195,2197,2198,2199,2203,2204,2205,2206,2208,2210,2213,2214,2216,2217,2220,2221,2223,2224,2227,2228,2233,2236,2239,2241,2243,2244,2245,2246,2251,2252,2254,2255,2256,2259,2265,2267,2271,2272,2273,2276,2280,2281,2282,2283,2284,2285,2287,2288,2289,2291,2292,2293,2294,2299,2314,2317,2318,2319,2322,2323,2324,2325,2326,2327,2328,2329,2330,2332,2334,2340,2343,2344,2345,2346,2348,2349,2351,2352,2358,2360,2361,2364,2369,2370,2371,2373,2375,2376,2378,2380,2382,2384,2385,2386,2387,2388,2390,2392,2393,2394,2397,2398,2400,2403,2406,2407,2408,2409,2411,2416,2421,2423,2424,2426,2428,2429,2431,2440,2442,2445,2446,2447,2449,2453,2457,2459,2460,2461,2462,2465,2466,2472,2473,2476,2477,2479,2480,2482,2484,2488,2495,2496,2497,2500,2501,2503,2510,2511,2512,2514,2515,2517,2518,2519,2522,2524,2527,2528,2530,2535,2537,2540,2546,2547,2548,2549,2551,2555,2556,2558,2561,2564,2567,2568,2574,2578,2581,2583,2584,2587,2592,2594,2595,2597,2600,2603,2605,2607,2610,2613,2618,2621,2623,2625,2626,2627,2628,2629,2630,2631,2633,2639,2640,2641,2645,2647,2648,2649,2651,2653,2658,2664,2665,2671,2672,2673,2674,2676,2678,2679,2680,2684,2686,2688,2692,2698,2699,2701,2705,2706,2709,2710,2714,2715,2717,2719,2720,2727,2728,2729,2732,2734,2735,2736,2739,2740,2741,2742,2744,2746,2748,2752,2759,2763,2767,2769,2770,2775,2776,2778,2781,2788,2797,2799,2807,2808,2815,2819,2820,2821,2822,2823,2824,2826,2831,2835,2837,2839,2842,2843,2844,2847,2849,2852,2856,2857,2859,2861,2862,2865,2866,2867,2870,2871,2872,2874,2876,2878,2879,2880,2881,2884,2886,2889,2893,2895,2901,2902,2906,2908,2910,2913,2915,2917,2923,2926,2927,2928,2929,2930,2932,2933,2936,2938,2941,2942,2943,2945,2947,2949,2950,2951,2952,2957,2959,2961,2963,2964,2967,2968,2969,2970,2978,2980,2981,2983,2986,2988,2989,2990,2991,2994,2996,2997,2998]
61-
inds_3 = [589,655,666,703,886,1001,1002,1004,1005,1008,1009,1010,1012,1022,1024,1029,1030,1031,1036,1037,1046,1050,1054,1055,1057,1058,1061,1062,1064,1065,1068,1069,1073,1075,1076,1077,1079,1083,1085,1088,1094,1096,1097,1103,1111,1112,1114,1117,1118,1119,1121,1122,1124,1131,1132,1135,1136,1137,1138,1141,1144,1145,1147,1149,1153,1154,1158,1160,1164,1169,1170,1171,1174,1178,1179,1180,1181,1184,1185,1186,1187,1188,1189,1190,1192,1193,1197,1199,1201,1202,1203,1204,1205,1206,1207,1208,1211,1221,1222,1223,1226,1228,1230,1231,1233,1234,1236,1239,1243,1245,1253,1255,1257,1259,1261,1262,1263,1264,1265,1266,1270,1271,1272,1273,1277,1280,1281,1283,1284,1286,1287,1288,1289,1290,1292,1293,1294,1297,1298,1299,1300,1302,1304,1305,1307,1309,1310,1313,1314,1315,1319,1322,1323,1329,1332,1333,1334,1335,1336,1342,1348,1349,1351,1354,1355,1358,1359,1361,1362,1363,1368,1369,1374,1379,1380,1381,1384,1385,1386,1394,1395,1396,1401,1403,1406,1408,1409,1410,1411,1413,1414,1415,1417,1418,1420,1421,1422,1424,1427,1428,1430,1431,1432,1436,1440,1443,1444,1445,1446,1447,1451,1454,1456,1458,1460,1461,1462,1466,1469,1470,1472,1474,1475,1476,1478,1486,1488,1490,1493,1497,1498,1501,1503,1505,1506,1507,1510,1512,1515,1517,1525,1530,1532,1535,1536,1538,1544,1545,1547,1548,1549,1551,1555,1558,1561,1565,1567,1568,1572,1573,1574,1576,1577,1578,1585,1587,1590,1593,1594,1595,1597,1600,1606,1607,1612,1614,1616,1619,1624,1627,1632,1633,1635,1637,1638,1639,1642,1643,1644,1645,1648,1651,1652,1654,1657,1659,1661,1665,1668,1673,1674,1676,1677,1678,1680,1681,1685,1689,1692,1695,1698,1699,1703,1704,1706,1707,1708,1709,1711,1712,1717,1719,1722,1723,1726,1727,1729,1730,1733,1736,1738,1739,1740,1742,1743,1750,1754,1758,1759,1760,1763,1764,1765,1767,1769,1772,1777,1778,1779,1781,1782,1789,1791,1794,1798,1799,1800,1801,1803,1804,1809,1810,1811,1812,1813,1818,1820,1821,1824,1828,1830,1831,1833,1836,1839,1841,1844,1847,1849,1852,1854,1855,1856,1860,1862,1867,1868,1869,1873,1874,1875,1877,1884,1885,1886,1891,1894,1895,1896,1897,1901,1902,1904,1907,1908,1909,1910,1911,1912,1914,1915,1918,1919,1920,1923,1924,1925,1928,1929,1931,1933,1934,1938,1939,1940,1942,1946,1948,1951,1952,1954,1955,1958,1959,1960,1961,1964,1968,1969,1971,1973,1974,1976,1977,1978,1982,1984,1985,1987,1993,1995,1996,1999,2000]
54+
# FIXME Current tests depend too much on a specific random sequence
55+
# We need better tests, that check point coordinates rather their indices
56+
inds_1 = [1, 3, 4, 5, 6, 9, 10, 12, 18, 22, 26, 29, 33, 35, 36, 39, 40, 42, 43, 46, 48, 50, 51, 52, 56, 57, 58, 60, 62, 63, 65, 70, 71, 72, 73, 74, 76, 80, 81, 84, 85, 86, 90, 91, 94, 95, 97, 100, 101, 102, 104, 107, 108, 112, 113, 114, 116, 117, 118, 119, 123, 124, 125, 126, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 142, 145, 155, 157, 159, 160, 161, 162, 167, 168, 169, 170, 172, 174, 175, 177, 180, 181, 182, 184, 185, 187, 189, 190, 191, 197, 199, 204, 205, 208, 209, 212, 215, 217, 218, 219, 221, 223, 225, 227, 228, 229, 230, 231, 237, 239, 240, 241, 247, 248, 249, 251, 254, 256, 259, 261, 264, 265, 266, 268, 274, 277, 282, 283, 284, 285, 287, 288, 289, 290, 293, 294, 295, 298, 304, 305, 307, 308, 311, 312, 316, 317, 319, 320, 321, 323, 325, 330, 335, 339, 340, 343, 344, 345, 347, 363, 364, 365, 366, 367, 370, 371, 373, 378, 383, 385, 388, 391, 393, 396, 400, 402, 403, 404, 405, 406, 409, 411, 412, 415, 416, 417, 418, 421, 422, 423, 425, 426, 427, 430, 433, 435, 440, 441, 442, 444, 448, 450, 451, 453, 462, 464, 467, 472, 473, 474, 476, 482, 484, 485, 488, 489, 490, 492, 494, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 508, 515, 519, 520, 526, 529, 530, 531, 532, 533, 536, 537, 542, 548, 556, 559, 562, 563, 565, 566, 567, 570, 574, 575, 576, 582, 584, 587, 588, 590, 591, 598, 600, 601, 602, 603, 604, 605, 608, 609, 612, 613, 614, 617, 621, 622, 623, 625, 627, 628, 629, 635, 636, 639, 641, 647, 650, 653, 655, 657, 659, 660, 661, 662, 665, 666, 667, 670, 671, 673, 674, 675, 676, 677, 679, 681, 683, 686, 688, 691, 694, 695, 696, 699, 701, 704, 706, 708, 711, 712, 713, 715, 717, 719, 720, 723, 724, 727, 729, 730, 731, 735, 739, 740, 741, 742, 743, 744, 746, 747, 750, 751, 755, 756, 761, 770, 772, 773, 774, 775, 780, 784, 787, 788, 790, 792, 794, 797, 800, 801, 802, 805, 806, 808, 809, 813, 814, 815, 816, 817, 821, 822, 824, 826, 827, 828, 830, 832, 833, 834, 835, 837, 843, 846, 847, 848, 850, 851, 854, 855, 857, 859, 862, 863, 864, 867, 869, 870, 872, 873, 875, 876, 878, 879, 880, 881, 884, 886, 887, 888, 889, 890, 892, 894, 901, 902, 908, 909, 913, 914, 917, 918, 919, 920, 922, 924, 928, 933, 934, 935, 936, 938, 940, 941, 943, 944, 948, 949, 950, 952, 953, 954, 960, 961, 965, 966, 970, 971, 979, 980, 983, 985, 986, 987, 990, 991, 993, 996, 1000, 1339, 2143]
57+
inds_2 = [132, 1001, 1003, 1006, 1008, 1011, 1014, 1015, 1017, 1018, 1019, 1020, 1023, 1024, 1027, 1028, 1034, 1036, 1039, 1042, 1044, 1045, 1047, 1049, 1051, 1052, 1056, 1057, 1058, 1059, 1064, 1065, 1068, 1070, 1071, 1076, 1081, 1084, 1087, 1089, 1090, 1093, 1094, 1095, 1096, 1097, 1099, 1100, 1102, 1103, 1108, 1110, 1111, 1112, 1113, 1119, 1120, 1123, 1124, 1125, 1130, 1131, 1136, 1140, 1142, 1143, 1146, 1147, 1156, 1158, 1161, 1162, 1167, 1168, 1172, 1174, 1176, 1177, 1178, 1179, 1183, 1186, 1187, 1190, 1191, 1192, 1193, 1200, 1201, 1202, 1203, 1206, 1209, 1210, 1212, 1213, 1215, 1217, 1219, 1222, 1226, 1229, 1230, 1231, 1232, 1233, 1239, 1241, 1242, 1244, 1246, 1247, 1249, 1250, 1251, 1256, 1257, 1258, 1260, 1261, 1263, 1264, 1265, 1266, 1268, 1275, 1276, 1282, 1285, 1286, 1287, 1291, 1293, 1294, 1295, 1300, 1303, 1307, 1308, 1313, 1315, 1318, 1320, 1325, 1331, 1333, 1336, 1337, 1341, 1345, 1346, 1347, 1348, 1350, 1351, 1355, 1358, 1360, 1361, 1362, 1364, 1365, 1368, 1370, 1372, 1373, 1374, 1378, 1379, 1381, 1382, 1383, 1386, 1392, 1393, 1394, 1396, 1397, 1398, 1400, 1401, 1405, 1406, 1408, 1410, 1413, 1415, 1416, 1418, 1419, 1420, 1421, 1426, 1431, 1433, 1434, 1437, 1441, 1445, 1446, 1447, 1448, 1452, 1453, 1454, 1455, 1459, 1462, 1463, 1464, 1466, 1467, 1468, 1473, 1474, 1476, 1477, 1478, 1480, 1484, 1485, 1487, 1489, 1490, 1492, 1493, 1499, 1501, 1502, 1503, 1504, 1505, 1507, 1514, 1515, 1517, 1519, 1521, 1522, 1524, 1526, 1528, 1529, 1534, 1541, 1542, 1544, 1545, 1546, 1551, 1552, 1553, 1555, 1556, 1561, 1564, 1566, 1567, 1568, 1569, 1571, 1574, 1575, 1576, 1583, 1586, 1588, 1589, 1590, 1592, 1594, 1596, 1597, 1598, 1599, 1601, 1602, 1603, 1604, 1606, 1607, 1608, 1609, 1610, 1612, 1615, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1627, 1629, 1633, 1635, 1641, 1643, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1654, 1656, 1658, 1659, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1673, 1678, 1683, 1684, 1685, 1690, 1692, 1696, 1700, 1701, 1703, 1705, 1706, 1708, 1709, 1710, 1712, 1713, 1716, 1718, 1719, 1720, 1722, 1723, 1725, 1726, 1727, 1729, 1730, 1736, 1737, 1738, 1739, 1740, 1742, 1743, 1744, 1747, 1748, 1749, 1752, 1755, 1758, 1761, 1769, 1771, 1775, 1776, 1777, 1785, 1787, 1791, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1803, 1805, 1806, 1808, 1811, 1816, 1818, 1821, 1822, 1827, 1828, 1829, 1830, 1831, 1834, 1838, 1839, 1845, 1849, 1850, 1851, 1852, 1853, 1857, 1859, 1864, 1867, 1869, 1870, 1871, 1872, 1878, 1886, 1888, 1889, 1898, 1900, 1901, 1904, 1908, 1912, 1913, 1914, 1915, 1916, 1917, 1919, 1921, 1924, 1929, 1932, 1933, 1935, 1936, 1938, 1940, 1941, 1942, 1948, 1949, 1951, 1952, 1954, 1955, 1957, 1962, 1964, 1965, 1966, 1973, 1976, 1977, 1978, 1979, 1984, 1985, 1988, 1993, 1994, 1996, 1998, 1999]
58+
inds_3 = [589, 703, 2002, 2004, 2005, 2006, 2008, 2010, 2014, 2015, 2016, 2017, 2019, 2022, 2023, 2024, 2025, 2031, 2032, 2035, 2036, 2038, 2041, 2042, 2044, 2046, 2048, 2052, 2053, 2056, 2057, 2058, 2059, 2060, 2063, 2066, 2070, 2071, 2072, 2073, 2075, 2076, 2078, 2080, 2081, 2083, 2085, 2088, 2089, 2093, 2096, 2097, 2098, 2099, 2101, 2103, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2120, 2124, 2125, 2126, 2127, 2128, 2129, 2135, 2136, 2138, 2142, 2144, 2146, 2147, 2151, 2152, 2155, 2163, 2164, 2165, 2166, 2172, 2173, 2176, 2177, 2178, 2185, 2186, 2187, 2189, 2190, 2191, 2193, 2195, 2196, 2197, 2198, 2200, 2201, 2203, 2204, 2205, 2211, 2213, 2214, 2215, 2218, 2219, 2221, 2228, 2231, 2233, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2245, 2249, 2250, 2251, 2252, 2253, 2258, 2259, 2260, 2265, 2270, 2273, 2274, 2275, 2277, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2290, 2291, 2292, 2294, 2296, 2297, 2299, 2301, 2303, 2304, 2305, 2306, 2310, 2311, 2312, 2316, 2317, 2322, 2324, 2325, 2329, 2331, 2332, 2333, 2334, 2335, 2336, 2339, 2341, 2342, 2343, 2344, 2349, 2350, 2351, 2355, 2356, 2359, 2360, 2362, 2364, 2365, 2368, 2370, 2372, 2377, 2380, 2384, 2385, 2386, 2388, 2393, 2403, 2404, 2405, 2406, 2407, 2410, 2411, 2412, 2415, 2418, 2420, 2421, 2422, 2423, 2427, 2428, 2430, 2433, 2434, 2437, 2439, 2440, 2441, 2442, 2443, 2445, 2449, 2452, 2453, 2455, 2458, 2459, 2462, 2464, 2473, 2474, 2479, 2481, 2482, 2484, 2485, 2487, 2488, 2489, 2493, 2494, 2495, 2499, 2504, 2508, 2511, 2513, 2515, 2517, 2521, 2524, 2528, 2530, 2534, 2535, 2536, 2537, 2539, 2540, 2541, 2543, 2545, 2547, 2548, 2549, 2550, 2551, 2555, 2560, 2561, 2562, 2564, 2570, 2572, 2574, 2576, 2578, 2583, 2584, 2585, 2587, 2594, 2595, 2597, 2598, 2599, 2602, 2603, 2605, 2608, 2610, 2611, 2612, 2614, 2618, 2620, 2621, 2623, 2625, 2626, 2627, 2629, 2631, 2632, 2634, 2636, 2637, 2641, 2643, 2647, 2648, 2649, 2652, 2655, 2656, 2657, 2663, 2670, 2672, 2674, 2675, 2676, 2677, 2679, 2680, 2685, 2687, 2691, 2693, 2695, 2696, 2697, 2698, 2700, 2702, 2703, 2706, 2707, 2711, 2713, 2715, 2716, 2717, 2718, 2719, 2721, 2722, 2723, 2724, 2726, 2728, 2730, 2736, 2737, 2739, 2740, 2741, 2745, 2747, 2750, 2752, 2754, 2755, 2758, 2759, 2763, 2764, 2765, 2767, 2770, 2771, 2772, 2774, 2777, 2783, 2784, 2786, 2787, 2790, 2794, 2797, 2800, 2801, 2802, 2803, 2804, 2806, 2807, 2808, 2811, 2817, 2818, 2819, 2822, 2823, 2827, 2830, 2833, 2838, 2839, 2842, 2843, 2844, 2845, 2846, 2850, 2851, 2852, 2857, 2861, 2862, 2863, 2866, 2876, 2877, 2878, 2880, 2881, 2882, 2884, 2885, 2888, 2890, 2891, 2893, 2894, 2895, 2897, 2902, 2904, 2905, 2906, 2909, 2910, 2911, 2915, 2918, 2919, 2922, 2924, 2925, 2926, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2940, 2941, 2942, 2947, 2948, 2950, 2951, 2952, 2960, 2966, 2972, 2973, 2974, 2976, 2977, 2978, 2983, 2985, 2987, 2990, 2991, 2992, 2994, 2996]
6259

6360
clusters = dbscan(points, 0.3, min_neighbors=2, min_cluster_size=100, leafsize=20)
61+
@test length(clusters) == 3
6462
@test clusters[1].core_indices == inds_1
6563
@test clusters[2].core_indices == inds_2
6664
@test clusters[3].core_indices == inds_3

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using Test
33
using Random
44
using LinearAlgebra
55
using SparseArrays
6+
using StableRNGs
67
using Statistics
78

89
tests = ["seeding",

test/vmeasure.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ using Clustering
3232
end
3333

3434
@testset "comparing 2 k-means clusterings" begin
35-
Random.seed!(34568)
35+
rng = StableRNG(34568)
3636
m = 3
3737
n = 1000
3838
k = 10
@@ -47,12 +47,12 @@ using Clustering
4747
end
4848

4949
@testset "comparing 2 random label assignments" begin
50-
Random.seed!(34568)
50+
rng = StableRNG(34568)
5151
k = 10
5252
n = 10000
5353

54-
a1 = rand(1:k, n)
55-
a2 = rand(1:k, n)
54+
a1 = rand(rng, 1:k, n)
55+
a2 = rand(rng, 1:k, n)
5656
v = vmeasure(a1, a2)
5757
@test v 0.0 atol=1e-2 # should be close to zero
5858
end

0 commit comments

Comments
 (0)