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

  • SEARCH
  • Home
  • 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 8012639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:23:05+00:00 2026-06-04T19:23:05+00:00

I was trying to think of an algorithm which chooses 6 random cells from

  • 0

I was trying to think of an algorithm which chooses 6 random cells from an array with 50 cells, such that the probability for each cell to be picked is equal.
I need to find a solution that uses the function Random(start,end) no more than 6 times.

I can’t use any extra data structure, and it is important that the probability for each cell to be picked will be equal and independent.

  • 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-06-04T19:23:06+00:00Added an answer on June 4, 2026 at 7:23 pm

    Call Random(0,49). Read the resulting cell, then shuffle everything after it in the array down one place so that you have a 49-cell array with the picked value missing.

    Call Random(0,48) and repeat 6 times.

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

Sidebar

Related Questions

I was trying to think an algorithm for naming an array. For example, it
I'm trying to think of a fast algorithm for the following issue. Given a
I am trying to implement a vision algorithm, which includes a prefiltering stage with
I'm trying to sort a collection derived from CollectionViewSource, which simply has SortDescriptions for
I am trying to think of an algorithm where I can create number of
I've been trying many times to create an algorithm to extract stroke information from
Suppose we have buyers and sellers that are trying to find each other in
I'm trying to write an algorithm (which I'm assuming will rely on natural language
I am trying to convert this dungeon algorithm from java into javascript, however, my
I'm trying to implement the Floyd's algorithm. I think there is a problem with

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.