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

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

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.


This library is used to implement games, simulations, and other applications dealing with playing cards. CardLib is highly optimized for speed, and can simulate billions of hands of blackjack or poker in minutes.


CardLib consists of a shared library (.so on Linux, .dll for Windows) with functions that can be linked directly into C programs, wrapper classes for C++ programs, Java classes and native methods for use by Java programs, and a Python module for use with Python 3.

Basic functions allow you to build lists of cards to represent decks, hands, discard piles, and other things; to shuffle cards and move cards around, and other things needed to simulate various games. Text functions allow input and output of cards and hands as text. More game-specific functions are included for evaluating hands in blackjack and poker.

At present, CardLib does not contain card images or other GUI functions. This is planned, as is code for Internet game servers, but the current focus of CardLib is simulation programs.


CardLib can be used from a pre-compiled binary, or for more flexibility you can build RandLib from source. There are APIs for C, C++, Java, and Python.

Credits and Copyrights

The library was created by Lee Daniel Crocker in 2013. To the extent possibile under law, Mr. Crocker has waived all copyright and related or neighboring rights to this work (CC0). Where the work of others has been included, this is noted, and such work may be licensed under different terms.