Card game and simulation library and tools. Part of the OneJoker project.

Project maintained by Lee Daniel Crocker
Lee's blog is etceterology.

onejoker
CC-0: To the extent possible under law, I, Lee Daniel Crocker waive all copyright and related or neighboring rights to all creative works original to me.

Using the library in your C code

C programs need only include the single header file ojcardlib.h, and link against the shared library (libojcard.so on Linux, ojcard.dll on Windows). The library will initialize itself properly, including properly seeding the random number generator. If you build the library yourself and link it statically, you will have to initialize the library yourself, like this:

int main(int argc, char *argv[]) {
    oj_init_library(0);
    . . .
}

The argument 0 tells the library to seed the RNG from system entropy, which is what you want in most cases. If you pass a nonzero value, that will be used to seed the RNG, which will then generate a reproducible sequence sometimes useful for testing. It is safe to call this initialization function even if it has been called previously (as it would be by the shared library).