-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
46 lines (31 loc) · 1013 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
** The first version (0.1) is not yet released. API subject to change! **
libdice is a small library used for parsing dice expression and rolling dice.
It is mainly suitable for small projects that wish to support pen and paper
style dice syntax.
Features:
o Written in clean C
o Easy API as well as advanced API
o Solid and reliable RNG
o Unit tests
Dice syntax support:
o Variable sides
o Variable amount
Requirements:
o arc4random_uniform (or libbsd on non-BSDs)
o cmocka (for unit tests)
o bison
o flex
Compilation
$ ./configure --prefix=/usr
$ make
$ doas make install
Usage:
The functions ``dice_simple`` and ``dice_parse`` create a new ``dice_t``
object which can be used in conjunction with ``dice_roll`` and
``dice_evaluate`` to generate random numbers. ``dice_free`` must be used
to cleanup a created ``dice_t`` object.
dice_t d20 = dice_simple(1, 20);
int64_t res = dice_roll(d20);
dice_free(d20);
Authors:
Florian Stinglmayr <florian@n0la.org>