Computer Science Canada

Trying to use class from GNU C++ library

Author:  abcdefghijklmnopqrstuvwxy [ Tue Jun 26, 2007 1:35 pm ]
Post subject:  Trying to use class from GNU C++ library

Hi, I am needing a random number generator more sophisticated than rand() and so I found this
http://www.lix.polytechnique.fr/~liberti/public/computing/prog/c/CPLUSPLUS/CONTRIB/GNU_STDLIB/libgpp.html#SEC44

I dunno if ACG fits my needs but I attempted to use it like this:

code:

ACG rNum((unsigned)time(0), 7); //ACG::ACG(seed, size)


But of course it won't compile because ACG isn't declared. The documentation doesn't give any examples of using ACG nor does it tell you what files to include. Does anyone know what files i need to include?

Also i tried getting other random number generators but I don't know how to install the libraries... i figure the GNU C++ library is already installed so. . . ya

Author:  Dan [ Tue Jun 26, 2007 5:32 pm ]
Post subject:  RE:Trying to use class from GNU C++ library

Why do you need a random number generator behond what c++ provids?

Author:  md [ Wed Jun 27, 2007 12:26 am ]
Post subject:  RE:Trying to use class from GNU C++ library

Because there are better random number generators? The standard C++ RNG is not cryptographically secure which is another reason to use something else.

You would need to have the source code for that particular library; from the looks if it it's from Art of Computer Programming, Vol III. Since finding the actual code might be difficult you could always implement the mersenne twister. Or download a library that does it if you are lazy.

Author:  wtd [ Wed Jun 27, 2007 11:49 am ]
Post subject:  RE:Trying to use class from GNU C++ library

Why would you need the source?

You just need a header file, and the appropriate library to link against.

Author:  abcdefghijklmnopqrstuvwxy [ Wed Jun 27, 2007 5:11 pm ]
Post subject:  Re: Trying to use class from GNU C++ library

yeah i think he means the source so i can see what libraries i need to include. I thought this ACG random number class would be in the gnu c++ library which i think is included in the standard gcc? If not than can someone tell me how to install a random number generator library... i'm confused about all this linking and stuff and my programs never compile...


: