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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:46:21+00:00 2026-05-29T15:46:21+00:00

PHP returns largest possible random value 32767 on windows? What is constraint on windows?

  • 0

PHP returns largest possible random value 32767 on windows?

What is constraint on windows?

echo getrandmax(); //32767
  • 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-29T15:46:22+00:00Added an answer on May 29, 2026 at 3:46 pm

    According to the PHP source-code, getrandmax() is defined as :

    PHP_FUNCTION(getrandmax)
    {
        if (zend_parse_parameters_none() == FAILURE) {
            return;
        }
    
        RETURN_LONG(PHP_RAND_MAX);
    }
    

    And PHP_RAND_MAX is defined as :

    #define PHP_RAND_MAX RAND_MAX
    

    RAND_MAX itself being defined as :

    /* System Rand functions */
    #ifndef RAND_MAX
    #define RAND_MAX (1<<15)
    #endif
    

    So, if there is an RAND_MAX defined, it is used…

    … And, on Windows with Visual Studio, there is indeed a RAND_MAX defined (quoting) :

    The constant RAND_MAX is the maximum value that can be returned by
    the rand function. RAND_MAX is defined as the value 0x7fff.

    So, basically, getrandmax() returns 32767 because that’s how it’s defined on Windows — and PHP often uses what the underlying system exports.

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

Sidebar

Related Questions

i have a php function which returns a random json encoded color <?php function
I'd like having a remote validator for a textfield. My PHP returns true/false value.
When php returns a serialized string, does it only rely on the input value
If my PHP returns a array with 6 elements how would I access each
I have noticed that cURL in PHP returns different data when told to output
For some reason one installation of Moodle 1.9.3+ has a problem that file.php returns
I am using jQuery and Ajax, and my Ajax.php file returns the following field
I have a PHP page that returns a piece of HTML to set the
I have a RPC encoded PHP webservice that returns a simple soap envelope with
PHP's explode function returns an array of strings split on some provided substring. It

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.