Thread: lrand and srand

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    18

    lrand and srand

    Are there any good tutorials on usig lrand48() and srand48() or any one that could explain it? I just wrote a quick program tat gave the value of RAND_MAX.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    main(void)
    {
         printf("RAND_MAX = %d\n, RAND_MAX);
    }
    Now I have to use lrand48() and srand48() and I am lost again. Sorry I am extremely new to linux and C. Thanks!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Type man lrand48 at your computer.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    ive never used or even heard of either of them, but after a very quick search showing the functions' description, return type, arguments, i imagine its just as easy to use if you already know how to use "srand" and "rand". if you dont know how to use the latter two functions, find an example of that (of which there are many), then modify it to use your functions.

Popular pages Recent additions subscribe to a feed