tendermint/libs
Dev Ojha c648c93807 Fix random distribution in bitArray.PickRandom (#2534)
* Fix random distribution in bitArray.PickRandom

Previously it was very biased. 63 "_" followed by a single "x" had
much greater odds of being chosen. Additionally, the last element was
skewed. This fixes that by first preproccessing the set of all true
indices, and then randomly selecting a single element from there.

This commit also makes the code here significantly simpler, and
improves test cases.

* unlock mtx right after we select true indices
2018-10-05 11:00:50 +04:00
..
autofile [libs/autofile] fix DATA RACE by removing openFile() call (#2539) 2018-10-04 17:57:59 -04:00
bech32 make linter happy 2018-07-02 12:06:43 -04:00
cli fix import paths 2018-07-01 22:36:49 -04:00
clist clist: speedup Next by removing defers (#2511) 2018-09-30 13:26:14 -04:00
common Fix random distribution in bitArray.PickRandom (#2534) 2018-10-05 11:00:50 +04:00
db docs: Add missing changelog entry and comment (#2451) 2018-09-20 11:14:02 +02:00
errors [libs/autofile & db/fsdb] Throw error if file permissions change (#2286) 2018-09-17 14:38:29 +04:00
events Switch usage of math/rand to cmn's rand (#1980) 2018-07-16 11:20:37 +04:00
flowrate mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
log Implement BFT time (#2203) 2018-08-31 19:33:51 -04:00
pubsub Merge branch 'develop' into jae/literefactor4 2018-07-23 23:28:14 -04:00
test fix test folder mishap 2018-07-01 22:50:31 -04:00
version mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
.editorconfig mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
.gitignore mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
CHANGELOG.md mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
README.md mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
circle.yml mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
test.sh mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00

README.md

TMLIBS

This repo is a home for various small packages.

autofile

Autofile is file access with automatic log rotation. A group of files is maintained and rotation happens when the leading file gets too big. Provides a reader for reading from the file group.

cli

CLI wraps the cobra and viper packages and handles some common elements of building a CLI like flags and env vars for the home directory and the logger.

clist

Clist provides a linekd list that is safe for concurrent access by many readers.

common

Common provides a hodgepodge of useful functions.

db

DB provides a database interface and a number of implementions, including ones using an in-memory map, the filesystem directory structure, an implemention of LevelDB in Go, and the official LevelDB in C.

events

Events is a synchronous PubSub package.

flowrate

Flowrate is a fork of https://github.com/mxk/go-flowrate that added a SetREMA method.

log

Log is a log package structured around key-value pairs that allows logging level to be set differently for different keys.

merkle

Merkle provides a simple static merkle tree and corresponding proofs.

process

Process is a simple utility for spawning OS processes.

pubsub

PubSub is an asynchronous PubSub package.