Chance is a Lua port of Chance.js, a library for generating
random data for a variety of situations. However, it is not a perfect
port as it does not support the entire API of the original and not all
functions behave the same way, e.g. the Lua function chance.float()
returns numbers in a different range than the original library’s
chance.floating()
.
Chance requires Lua 5.1 or later, or LuaJIT 2.0 or later.
Simply place chance.lua
somewhere in the package path where
require()
can find it, and then use the library like so:
local chance = require("chance")
Running LDoc on chance.lua
will create a doc/
directory with
detailed information on the library’s API.
That documentation is also available online.
If Tup is available then running tup
within the project
directory will…
- Run LDoc to create documentation.
- Test for any errors in the code via Luacheck.
- Run the test suite in
chance.spec.lua
via Busted. Output will go into the file/tmp/chance-busted.log
. - Create a
TAGS
file for Emacs via Exuberant Ctags.
Tup and all other tools mentioned above are optional and not required to use the Chance library.
Copyright 2015 Plutono Inc.
This project follows Semantic Versioning.