Skip to content

Implement Fisher Yates algorithm#172

Draft
kayvank wants to merge 2 commits intoDataHaskell:mainfrom
kayvank:170/implement-Fisher-Yates-algorithm
Draft

Implement Fisher Yates algorithm#172
kayvank wants to merge 2 commits intoDataHaskell:mainfrom
kayvank:170/implement-Fisher-Yates-algorithm

Conversation

@kayvank
Copy link
Contributor

@kayvank kayvank commented Mar 1, 2026

No description provided.

@kayvank kayvank marked this pull request as draft March 1, 2026 01:13
@daikonradish
Copy link
Contributor

Thanks for submitting a PR! I'll have a good look at it later but if you're open to it, you could look at a one-time test for randomness here:

https://cnut1648.github.io/files/posts/Test_for_rand.pdf

Basically, take the indices that are output by shuffleVec and take a look at the distribution. But that's might be overkill.

where
shuffleVec :: (RandomGen g) => g -> VU.Vector Int -> VU.Vector Int
shuffleVec g v = runST $ do
vm <- VU.thaw v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of declaring the vector from list just to thaw it we can just create a new one in the shuffle vec function.

@kayvank kayvank force-pushed the 170/implement-Fisher-Yates-algorithm branch from fc6f38a to cc83918 Compare March 1, 2026 17:57
Issue 170, implement PR comments and clean up build warnings
@kayvank kayvank force-pushed the 170/implement-Fisher-Yates-algorithm branch from cc83918 to 3e69bd5 Compare March 1, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants