Thread: drand48()

  1. #1
    Registered User
    Join Date
    Nov 2018
    Posts
    1

    Question drand48()

    Hi, I have trouble finding drand48. Can you guys explain to me this question. Thank you.

    When we want to generate a uniformly distributed integer between 0 and n - 1, including 0 and n - 1, we can do the following:
    rndInt = (unsigned) floor(drand48() * n);


    (a) Write code to generate a uniformly distributed integer between 2 and 29, including 2 and 29.
    (b) Write code to generate a uniformly distributed integer between -17 and 7, including -17 and 7.



  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    It never hurts to read the manual. (Or if you have some more specific question I suppose you could ask that.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. drand48 returning 0's and nan
    By Destinps in forum C Programming
    Replies: 13
    Last Post: 10-10-2012, 09:46 PM
  2. working of drand48()
    By broli86 in forum C Programming
    Replies: 1
    Last Post: 04-11-2008, 11:08 AM
  3. drand48() Probability
    By BENCHMARKMAN in forum C Programming
    Replies: 11
    Last Post: 02-18-2008, 08:57 PM
  4. drand48
    By justgotthis in forum Linux Programming
    Replies: 3
    Last Post: 10-07-2005, 11:48 PM
  5. help with getting drand48() to work
    By v3dant in forum C++ Programming
    Replies: 4
    Last Post: 10-22-2004, 08:43 AM

Tags for this Thread