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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:12:34+00:00 2026-06-16T18:12:34+00:00

We all know good old Math.random() . It returns a random floating point number

  • 0

We all know good old Math.random(). It returns a random floating point number between 0 and 1.

What I can’t seem to find any evidence about is if zero or one is exclusive or inclusive.

I know that if they are inclusive, the probability of hitting either one of these values is seriously low.

But I can’t help but wonder if I should wasting an if statement looking for it or not.

In my current scenario zero is not a problem, but one is.

var __rand:uint = Math.floor( Math.random() * myArray.length );
var result:String = myArray[__rand];

if the 1 in Math.random() is exclusive, then I will know that will NEVER be 1, and therefore __rand could never equal myArray.length and should always be below it.. But just wasn’t sure if I should waste time in some performance critical code if I should account for it.

PS: The code above is NOT the performance critical code, just an example

Basically, just 2 simple questions.
1) Is returning one impossible or possible.
2) If possible, is it worth accounting for it.

  • 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-16T18:12:36+00:00Added an answer on June 16, 2026 at 6:12 pm

    Math.random will return a number between 0 and (1 exclusive). Never will return a 1.

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

Sidebar

Related Questions

We all know the good old disable the submit button trick but what are
Does anybody know a good C sample that loads bitmaps and handles all the
Good day, all. I know that this is a pretty basic question in terms
We all know the effects that lots of thrown exceptions can have over the
Does anyone know how I can configure bamboo to purge it's old builds. I
Is it possible to clear all resources in PHP? I know that you can
Found several good(related) questions here and here but all are nearly a year old.
We all know that openId has become such a popular method for user authentication,
We all know of sleep method available in java threads.. I understand that the
We all know that CSS sprite images are great to reduce the amount of

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.