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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:10:44+00:00 2026-05-30T09:10:44+00:00

So, I have a problem. Basically, I didn’t pay enough attention in high school

  • 0

So, I have a problem. Basically, I didn’t pay enough attention in high school math, and now I’m stuck. I need to generate random numbers between 1 adn 20 with a heavy emphasis on the one between 1 and 5, a light emphasis on 5-10, and a low emphasis on 10-20. I don’t understand all the fancy probability words and all the stuff they say in the articles I’ve come across. Any help you guys can provide would be appreciated. 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-30T09:10:45+00:00Added an answer on May 30, 2026 at 9:10 am

    You can use this formula to generate a random number in the range [low, high]:

    var randomNumber:int = Math.floor(Math.random()*(1+high-low))+low;
    

    You can put that in a function if you want.

    Now, an easy way to have a different probability for the three intervals you provided, is to do something like this:

    var random:Number = Math.random();
    if (random < 0.75) {
        // generate random number in [1, 5]
    } else if (random < 0.95) {
        // generate random number in [6, 10]
    } else {
        // generate random number in [11, 20]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is basically a math problem, but very programing related: if I have 1
The problem is basically this, in python's gobject and gtk bindings. Assume we have
can anyone help? I have a problem aligning rounded corners in IE6/7. Basically everything
Basically my problem stems from a desire to have the textbox portion be white,
I have basically the same problem outlined in this question, however I am using
I have a pretty simple problem. Basically I have an array called $list that
I have a bit of a problem with user controls. Basically what I want
This is an annoying problem I am having with Twisted.web. Basically, I have a
I have a tricky Django problem which didn't occur to me when I was
I'm writing my own CSS for jQuery UI. Basically, I need to have different

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.