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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:03:07+00:00 2026-06-07T16:03:07+00:00

Possible Duplicate: Is this C implementation of Fisher-Yates shuffle correct? In order to simulate

  • 0

Possible Duplicate:
Is this C implementation of Fisher-Yates shuffle correct?

In order to simulate different order of input sequence into my application, I would like to generate a list of randomize sequence for an array input. For example, given an arr[10], the default sequence is 0,1,..,8,9. However, I’d like to manipulate the sequence into random order, for eg, 2,4,5,1,9,0,3,7,8,6.

I think rand() will generate a random value between 0-9, but it doesn’t assure that each element is generated at least once. In such case, I am thinking about below pseudo, but is there a better way to generate random input sequence, and assure each number within the given range is generated at least once?

round #1:  
  generate a random number within 0-9.  
    let say 2 is selected  

round #2:  
    generate a random number within 0-1  
    generate a random number within 3-9  
    let say 0 and 4 are selected  

round #3:  
    generate a random number within 1  
    generate a random number within 3  
    generate a random number within 5-9  
    let say 1, 3, 7 are selected  

round #4:  
    generate a random number within 5-6  
    generate a random number within 8-9  

continue until 10 numbers are selected
  • 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-07T16:03:08+00:00Added an answer on June 7, 2026 at 4:03 pm

    Look at Fisher-Yates shuffle algorithm here for your requirement.

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

Sidebar

Related Questions

Possible Duplicate: J2ME power(double, double) math function implementation I'm developing a simple j2me application.
Possible Duplicate: Android NoSuchAlgorithmException: SSLContext SSL implementation not found Has anybody experience with this
Possible Duplicate: Why tack a protocol of NSObject to a protocol implementation Does this
Possible Duplicate: Is this a good way to generate a string of random characters?
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Possible Duplicate: Why do this Ruby object have two to_s and inspect methods that
Possible Duplicate: Why is this code invalid in C#? Conditional operator cannot cast implicitly?
Possible Duplicate: Why does this integer division yield 0? I have a C header
Possible Duplicate: Why does this intentionally incorrect use of strcpy not fail horribly? Below
Possible Duplicate: Reference - What does this symbol mean in PHP? I have a

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.