Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3280572
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:43:11+00:00 2026-05-17T19:43:11+00:00

In particular, I want to make sure to avoid the mistake made in Microsoft’s

  • 0

In particular, I want to make sure to avoid the mistake made in Microsoft’s Browser Choice shuffle code. That is, I want to make sure that each letter has an equal probability of ending up in each possible position.

e.g. Given “ABCDEFG”, return something like “GEFBDCA”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:43:11+00:00Added an answer on May 17, 2026 at 7:43 pm

    I modified an example from the Fisher-Yates Shuffle entry on Wikipedia to shuffle strings:

    String.prototype.shuffle = function () {
        var a = this.split(""),
            n = a.length;
    
        for(var i = n - 1; i > 0; i--) {
            var j = Math.floor(Math.random() * (i + 1));
            var tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
        return a.join("");
    }
    console.log("the quick brown fox jumps over the lazy dog".shuffle());
    //-> "veolrm  hth  ke opynug tusbxq ocrad ofeizwj"
    
    console.log("the quick brown fox jumps over the lazy dog".shuffle());
    //-> "o dt hutpe u iqrxj  yaenbwoolhsvmkcger ozf "
    

    More information can be found in Jon Skeet’s answer to Is it correct to use JavaScript Array.sort() method for shuffling?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have n lists of numbers. I want to make sure that each list
This is my ajax pager code below: Now I want to make sure that
In particular, can filtered replication be done with PouchDB? I want to make sure
I want to open an .ics file & i want to make sure that
I am working on asp.net mvc3 and i want a particular requirement that the
I think the answer is yes but I just want to make sure. so
I'm exporting my Dataset to an excel file, and I want to make sure
I just want to make sure I'm following the right approach. In my application
this is my first programming course, and i want to make sure i am
Is there a function out there to make sure that any given array conforms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.