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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:35:35+00:00 2026-05-29T07:35:35+00:00

This isn’t so much a coding question as a how would I code question

  • 0

This isn’t so much a coding question as a “how would I code” question – I don’t know if SO is the right place, so sorry if that’s the case.

Imagine an online test that has 75 questions. Each person taking the test will see five “random” questions (but, as you’ll see, it’s not random at all).

I need to know how to order these questions to give them an equal chance of being seen (so, after 750 people have taken the test, all the questions have been seen ten times).

Would it be best to write a script that looks to see which question has the lowest number of hits, and then show that one? Or to set up a preset list of questions for each user to see?

The script will be written in PHP with a MySQL backend, not that I think that’s important.

  • 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-29T07:35:36+00:00Added an answer on May 29, 2026 at 7:35 am

    If you really want all 75 questions be uniformly displayed I’d do something like this:

    1. Create a table with a random list of all questions (ids to the questions).
    2. When a questions is requested, get the first id from the table and remove it.
    3. If the table is empty then create a new list and get the first.
    4. Etc.
    

    in this way you get random questions for each user and not the same question twice until all questions have been displayed.

    You may also need to keep track of which questions each user has already gotten. Log this in another table and if there is a hit then skip that one and get and remove the next instead.

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

Sidebar

Related Questions

This isn't much of a coding question as opposed to seeking help on going
This isn't a question that has a black/white yes/no answer, this is more a
This isn't exactly a programming question exactly. I just want to know what your
This isn't a question on proper coding practice, I'm just working through the semantics.
this isn't really an issue, but more of a concern that I would appreciate
This isn't actually a homework question per se, just a question that keeps nagging
This isn't a development question, I'm Looking for a plugin for Joomla that allows
This isn't the complete code, but it's the parts that are causing problems. I've
This isn't my code, I'm just troubleshooting it. Some code that has been working
This isn't quite the same question as many others that it might resemble. Consider

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.