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 6590689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:19:54+00:00 2026-05-25T17:19:54+00:00

Right now I’m using the Mersenne Twister RNG and performing Fisher-Yates shuffle algorithm 100

  • 0

Right now I’m using the Mersenne Twister RNG and performing Fisher-Yates shuffle algorithm 100 times:

    std::vector<Card> shufCards;
    for(int i = 0; i < 4; ++i)
    {
        for(int j = 0; j < 13; ++j)
        {

            shufCards.push_back(Card((Card::SuitEnum)i,(Card::RankEnum)j));
        }
    }
    for(int r = 0; r < 100; ++r)
    for(int i = shufCards.size() - 1; i >= 1; i--)
    {
        int j = m_randomGenerator.genrand_int31() % (i + 1);
        std::swap(shufCards[i],shufCards[j]);
    }

    std::vector<Card> cards;
    for(int i = 0; i < zeroBasedCut; ++i)
    {
        cards.push_back(shufCards[i]);
    }

    for(int i = zeroBasedCut; i < 52; ++i)
    {
        cards.push_back(shufCards[i]);
    }


    return cards;

But it feels like the amount of cards per suit is off and somewhat predictable. It is highly unlikely to have a hand of 13 cards with just 1 heart and 5 spades but this happens rather often.

What is a better RNG I could use for this?

Thanks

  • 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-25T17:19:54+00:00Added an answer on May 25, 2026 at 5:19 pm

    Our perception of randomness is notoriously poor. If you suspect that your routine is skewed in some way, I’d recommend conducting a large number of random trials using your routine and then looking at the realized probabilities of various hand distributions, and comparing them with what is to be expected theoretically.

    Other than this, I’ve got a couple of observations:

    1. Why shuffle multiple times? One pass should do as good a job.
    2. What’s the purpose of zeroBasedCut? What does it achieve that Fisher-Yates doesn’t?
    3. Why not use std::random_shuffle instead of your own routine?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I am using sqlite within a ios application, and I want to
Right now, I have three models Post, Comment and User (using Devise ) associated
right now i m using adobe live media encoder to stream live webcam video
Right now I'm using the jQuery selector $('foo+bar') . Since I already have $('foo')
Right now I'm using the following command to compile a coffeescript file each time
Right now I'm using OleDbDataAdapter objDataReader = new OleDbDataAdapter(); objDataReader.SelectCommand = myCommand; objDataReader.Fill(myDataTable); But
Right now, to be sure I am getting what I want I am using
Right now I'm selecting 3 random rows from a table using ORDER BY Rand();
Right now I am updating user_list List using jquery and submitting the form data
Right now I am listing all of a users microposts using the code below.

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.