use of random()

This is a discussion on use of random() within the C Programming forums, part of the General Programming Boards category; I am editing a previous bit of code given to me .. but I am having a few problems. I ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    5

    Unhappy use of random()

    I am editing a previous bit of code given to me .. but I am having a few problems.
    I have compiled the program and used the random() and srandom() fuctions in a similar style to rand as well as included the math.h
    .. but however the system does not recogise these fuctions. Yet compiles with out a problem on a SUN machine.
    Any one got any ideas ?

    Cheers in advance

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    5
    well the prob with rand() is that it encompasses a large rang of numbers .. the random() fuction is between 1 and 0 .. I would write another fuction .. but I was hoping to utalise this functionality

    ta

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    ... or you could just read the FAQ
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. random to int?
    By psyadam in forum C# Programming
    Replies: 7
    Last Post: 07-22-2008, 08:09 PM
  2. Lesson #3 - Math
    By oval in forum C# Programming
    Replies: 2
    Last Post: 04-27-2006, 08:16 AM
  3. Another brain block... Random Numbers
    By DanFraser in forum C# Programming
    Replies: 2
    Last Post: 01-23-2005, 04:51 PM
  4. How do I restart a random number sequence.
    By jeffski in forum C Programming
    Replies: 6
    Last Post: 05-29-2003, 02:40 PM
  5. Best way to generate a random double?
    By The V. in forum C Programming
    Replies: 3
    Last Post: 10-16-2001, 04:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21