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

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

    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...

    --Goo$ematt

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    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, 03:25 PM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  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, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM