Thread: rand() result required float!!!!

  1. #1
    * S T U D E N T *
    Join Date
    Oct 2003

    Arrow rand() result required float!!!!

    Hello all,

    i want to use the rand() to produce a float between 0.00000 and 1.00000.

    i already have an srand() for a seed.

    thanks in advance...


  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    r = (double)rand() / RAND_MAX;
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 04:25 PM
  2. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  3. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 02:19 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 12:58 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM
Website Security Test