René's URL Explorer Experiment


Title: [BUG]: Biased shuffle implementation in bogoSort (incorrect Fisher–Yates range) · Issue #1867 · TheAlgorithms/JavaScript · GitHub

Open Graph Title: [BUG]: Biased shuffle implementation in bogoSort (incorrect Fisher–Yates range) · Issue #1867 · TheAlgorithms/JavaScript

X Title: [BUG]: Biased shuffle implementation in bogoSort (incorrect Fisher–Yates range) · Issue #1867 · TheAlgorithms/JavaScript

Description: Description The current shuffle function used by the bogoSort implementation appears to implement a biased version of the Fisher–Yates shuffle. Specifically, the random index is selected from an incorrect range, which prevents some permu...

Open Graph Description: Description The current shuffle function used by the bogoSort implementation appears to implement a biased version of the Fisher–Yates shuffle. Specifically, the random index is selected from an in...

X Description: Description The current shuffle function used by the bogoSort implementation appears to implement a biased version of the Fisher–Yates shuffle. Specifically, the random index is selected from an in...

Opengraph URL: https://github.com/TheAlgorithms/JavaScript/issues/1867

X: @github

direct link

Domain: redirect.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: Biased shuffle implementation in bogoSort (incorrect Fisher–Yates range)","articleBody":"### Description\n\nThe current `shuffle` function used by the `bogoSort` implementation appears to implement a biased version of the Fisher–Yates shuffle.\n\nSpecifically, the random index is selected from an incorrect range, which prevents some permutations from ever occurring. This results in a non-uniform shuffle and may affect the theoretical correctness of randomized algorithms such as `bogoSort`.\n\n### Expected Behavior\n\nThe shuffle function should implement an unbiased Fisher–Yates algorithm, where each permutation of the array is equally likely.\n\nThis requires selecting the random index from the inclusive range [0, i] during each iteration.\n\n### Actual Behavior\n\nThe current implementation selects the random index from ` [0, i) `, which introduces bias and makes some permutations impossible.\n\nAs a result:\n\n- The shuffle is not uniform\n- The sorted permutation may be unreachable for certain inputs\n- The expected probabilistic behaviour of `bogoSort` is violated\n\n### Steps to reproduce (if applicable)\n\n1. Use the current shuffle implementation\n2. Shuffle a small array (e.g. [1, 2, 3]) many times\n3. Count permutation frequencies\n4. Observe that some permutations never appear or appear significantly less often\n\n### Additional information\n\n#### Suggested fix\n\nUpdate the shuffle to use the standard Fisher–Yates algorithm:\n\n```js\nfunction shuffle(array) {\n  for (let i = array.length - 1; i \u003e 0; i--) {\n    const j = Math.floor(Math.random() * (i + 1));\n    [array[i], array[j]] = [array[j], array[i]];\n  }\n}\n```","author":{"url":"https://github.com/Ayoub-FG","@type":"Person","name":"Ayoub-FG"},"datePublished":"2025-12-23T19:42:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1867/JavaScript/issues/1867"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:34e38a93-fe33-a862-12b3-a53cae258200
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD704:21279A:44B9F0:58E484:696B09E6
html-safe-nonce62e901a88defa1cc69436fd01baa33e87fe01a2d6ffa559f7cb56d5e81718ecf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzA0OjIxMjc5QTo0NEI5RjA6NThFNDg0OjY5NkIwOUU2IiwidmlzaXRvcl9pZCI6IjI2NTUxNDkzNTUzODY0NzI5MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8f03801bb49a6d55cd860e428bfe06113fd35a9a04a5d434336f34fc6d94b04f
hovercard-subject-tagissue:3758372651
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TheAlgorithms/JavaScript/1867/issue_layout
twitter:imagehttps://opengraph.githubassets.com/067676eb2581306548b5e7dd0cea4112d42c0b20235b5f84dccccfda4888f29c/TheAlgorithms/JavaScript/issues/1867
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/067676eb2581306548b5e7dd0cea4112d42c0b20235b5f84dccccfda4888f29c/TheAlgorithms/JavaScript/issues/1867
og:image:altDescription The current shuffle function used by the bogoSort implementation appears to implement a biased version of the Fisher–Yates shuffle. Specifically, the random index is selected from an in...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAyoub-FG
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
go-importgithub.com/TheAlgorithms/JavaScript git https://github.com/TheAlgorithms/JavaScript.git
octolytics-dimension-user_id20487725
octolytics-dimension-user_loginTheAlgorithms
octolytics-dimension-repository_id97086543
octolytics-dimension-repository_nwoTheAlgorithms/JavaScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id97086543
octolytics-dimension-repository_network_root_nwoTheAlgorithms/JavaScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867#start-of-content
https://redirect.github.com/
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJavaScript%2Fissues%2F1867
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJavaScript%2Fissues%2F1867
Sign up https://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TheAlgorithms%2FJavaScript
Reloadhttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867
Reloadhttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867
Reloadhttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867
TheAlgorithms https://redirect.github.com/TheAlgorithms
JavaScripthttps://redirect.github.com/TheAlgorithms/JavaScript
Please reload this pagehttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867
Notifications https://redirect.github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Fork 5.8k https://redirect.github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Star 34k https://redirect.github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Code https://redirect.github.com/TheAlgorithms/JavaScript
Issues 21 https://redirect.github.com/TheAlgorithms/JavaScript/issues
Pull requests 167 https://redirect.github.com/TheAlgorithms/JavaScript/pulls
Actions https://redirect.github.com/TheAlgorithms/JavaScript/actions
Projects 0 https://redirect.github.com/TheAlgorithms/JavaScript/projects
Wiki https://redirect.github.com/TheAlgorithms/JavaScript/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://redirect.github.com/TheAlgorithms/JavaScript/security
Please reload this pagehttps://redirect.github.com/TheAlgorithms/JavaScript/issues/1867
Insights https://redirect.github.com/TheAlgorithms/JavaScript/pulse
Code https://redirect.github.com/TheAlgorithms/JavaScript
Issues https://redirect.github.com/TheAlgorithms/JavaScript/issues
Pull requests https://redirect.github.com/TheAlgorithms/JavaScript/pulls
Actions https://redirect.github.com/TheAlgorithms/JavaScript/actions
Projects https://redirect.github.com/TheAlgorithms/JavaScript/projects
Wiki https://redirect.github.com/TheAlgorithms/JavaScript/wiki
Security https://redirect.github.com/TheAlgorithms/JavaScript/security
Insights https://redirect.github.com/TheAlgorithms/JavaScript/pulse
New issuehttps://redirect.github.com/login?return_to=https://github.com/TheAlgorithms/JavaScript/issues/1867
New issuehttps://redirect.github.com/login?return_to=https://github.com/TheAlgorithms/JavaScript/issues/1867
[BUG]: Biased shuffle implementation in bogoSort (incorrect Fisher–Yates range)https://redirect.github.com/TheAlgorithms/JavaScript/issues/1867#top
bugSomething isn't workinghttps://github.com/TheAlgorithms/JavaScript/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/Ayoub-FG
https://github.com/Ayoub-FG
Ayoub-FGhttps://github.com/Ayoub-FG
on Dec 23, 2025https://github.com/TheAlgorithms/JavaScript/issues/1867#issue-3758372651
bugSomething isn't workinghttps://github.com/TheAlgorithms/JavaScript/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.