Thread: random?

  1. #1
    Unregistered
    Guest

    random?

    how can i write such a functýon

    ex:

    random1(89.434, 234.3434);

    and it returns a flouting point between this numbers?

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    14
    how can i write such a functýon

    ex:

    random1(89.434, 234.3434);

    and it returns a flouting point between this numbers?
    like this
    Code:
    float(random)(float one,float two)
        {
        float f=(float)rand()/RAND_MAX*(two-one);
        return f;
        }

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, 05: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