Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I get different results on different platforms when started from the
populateRandomString :: SMGen -> Text populateRandomString smGen = let (char, ngen) = randomR ('A', 'Z') smGen (char2, gen2) = randomR ('A', 'Z') ngen in pack (char : [char2])
And a test code for it:
The above tests pass fine in Linux & OSX platform. But for Windows it
test\SplitSpec.hs:27:7: 2) Split, Splitmax test, random string expected: "QH" but got: "SF"
Is my assumption wrong somewhere ? Note that I don't get the problem
Issue reproducible in Azure CI: https://dev.azure.com/psibi2000/splitmix-debug/_build/results?buildId=906
I tried this on windows and linux (on the same 64bit machine), in https://github.com/phadej/splitmix/compare/issue23 and I am unable to reproduce.
And this is a sample Azure build where it fails: https://dev.azure.com/psibi2000/splitmix-debug/_build/results?buildId=906
From looking at the build agent docs, it does seem to be 64-bit - so I don't think it's a problem because of 32bit/64bit variants. I upgraded the image to use windows 2019 server and I was able to reproduce the same issue: https://dev.azure.com/psibi2000/splitmix-debug/_build/results?buildId=908
I'm still unable to reproduce. Note that second part of seed is always odd, so your first test is broken. With
diff --git a/test/SplitSpec.hs b/test/SplitSpec.hs index a8cf2e5..416c5fc 100644 --- a/test/SplitSpec.hs +++ b/test/SplitSpec.hs @@ -17,16 +17,16 @@ spec :: Spec spec = do describe "Splitmax test" $ do it "seed/unseed" $ do - let seed = (10000, 10000) + let seed = (10000, 10001) gen = seedSMGen' seed outputSeed = unseedSMGen gen seed `shouldBe` outputSeed it "random string" $ do - let seed = (10000, 10000) + let seed = (10000, 10001) let txt = populateRandomString (seedSMGen' seed) txt `shouldBe` "QH" it "splitSMGen" $ do - let seed = (10000, 10000) + let seed = (10000, 10001) (gen1, gen2) = splitSMGen $ seedSMGen' seed gen1unseed = unseedSMGen gen1 gen2unseed = unseedSMGen gen2
change the suite passes both on windows and linux.
@phadej Thanks for the pointers! I modified the code to use
Note that the Azure CI test still fails in Windows (passes fine in Linux & OSX): https://dev.azure.com/psibi2000/splitmix-debug/_build/results?buildId=914
Also, I have uploaded a