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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:11:05+00:00 2026-06-10T21:11:05+00:00

For generating random doubles, there is drand48, but These functions are declared obsolete by

  • 0

For generating random doubles, there is drand48, but

These functions are declared obsolete by SVID 3, which states that
rand(3) should be used instead.

How do I construct my random double with drand48? On a side note, the
random float?

Simply concatenating two int from rand() and casting may lead to
NaN, which is not acceptable. I’d like to avoid using only 32 random
bits for a double.

  • 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-10T21:11:07+00:00Added an answer on June 10, 2026 at 9:11 pm

    This citation of an obsolete standard in the man pages for linux is unfortunate. If I see correctly SVID 3 was published 1986, and obsoleted itself since long. POSIX has this family of functions and there are no plans to phase them out.

    But if you are at it, consider to use erand48 instead of drand48. It has the advantage that you provide it with a seed state yourself. By that it is reentrant, generally behaves better if you use it in a threaded environment (and initialize the seeds for threads differently) or is deterministic if you need it for reproducible simulations.

    The only little thing is that you have to have in mind is that it only gives you 48 bits of pseudo-randomness. Usual double arithmetic is with 52 bit, so be careful that you don’t use the lowest 4 bits, they are no good.

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

Sidebar

Related Questions

Is there any way of generating random text which satisfies provided regular expression. I
I am generating random fireballs, but my problem that it's generating much number of
I'm looking for tools for generating random but realistic text. I've implemented a Markov
I am generating my world (random, infinite and 2d) in sections that are x
Most functions for generating lognormally distributed random numbers take the mean and standard deviation
For generating random string i written code like this But if the function is
i am generating random password. but i want to get phonetic string of the
I have a standalone Java application below that is: Generating a random line Applied
Is there any well-known method for generating random, good looking and yet distinctive colors?
I'm having trouble generating random numbers that do not follow a discrete uniform distribution.

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.