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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:37:38+00:00 2026-06-05T21:37:38+00:00

I want to use the function gmp_random() by GNU MP in PHP. I need

  • 0

I want to use the function gmp_random() by GNU MP in PHP.
I need to set the exact value of bits I want (for example a random number with 64bit length).

The limiter parameter is multiplied with the “number of bits per limb”. How can I get this value?
Is that ever equivalent to the bit-count of the CPU or is there any PHP function to get the value?

In the original library it is represent by the const mp_bits_per_limb.

  • 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-05T21:37:39+00:00Added an answer on June 5, 2026 at 9:37 pm

    Seems like there’s no simple way to solve that.

    You can either pretend that mp_bits_per_limb equals PHP_INT_SIZE*8 and just use that (will work on most, but not all architectures). The resulting bugs will be tough and a worthy thing to debug for any developer. So this is probably the way to go 🙂

    Or work around it by knowing that mp_bits_per_limb will not be smaller than 16, so you just use “number_of_bits_you_want/16”, get a result that has too many bits and gmp_and() your result with 0xFFFF, 0xFFFFFFFF or 0xFFFFFFFFFFFFFFFF to cut it down to 16, 32 or 64 bits.

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

Sidebar

Related Questions

I want to use gcd function of the Integer class. Using the example from
I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
I want to use Javascript Alert function in my ASP.NET page. For example like
[CheckAtomicResultCriteria] is a Scalar value function that returns a BIT. I want to use
I want to use this function EnumWindows(EnumWindowsProc, NULL);. The EnumWindowsProc is a Callback function:
i want to use .animate function but i have some problems i want to
I want to use magic function __set() and __get() for storing SQL data inside
i want to use focus function in jquery to return to same area of
I want to use the filter function of DataTables, but don't want to use
I want to use an initialization function that will be called after a user

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.