mirror of
https://github.com/valitydev/ranger.git
synced 2024-11-06 08:55:18 +00:00
Range tool
src | ||
.gitignore | ||
LICENSE | ||
README.md | ||
rebar.config | ||
rebar.lock | ||
renovate.json |
ranger
Range tool
Usage
1> RangeMap = ranger:get_ranges(65535, 16, [0, 3, 5, 6, 11, 15]).
#{{8872,9553} => 3,
{8190,8871} => 0,
{18426,19107} => 6,
{34124,34805} => 5,
{51186,51867} => 6,
{16380,17061} => 0,
{19108,19789} => 11,
{29347,30028} => 3,
{60740,61424} => 15,
{56645,57329} => 15,
{38901,39582} => 6,
{42996,43677} => 6,
{59376,60057} => 6,
{45045,49139} => 11,
{55963,56644} => 11,
{24570,28664} => 6,
{36170,36854} => 15,
{6141,6822} => 6,
{36855,37536} => 0,
{57330,58011} => 0,
{6823,7504} => 11,
{10236,10917} => 6,
{11600,12284} => 15,
{58012,58693} => 3,
{43678,44359} => 11,
{50504,51185} => 5,
{32075,32759} => 15,
{52550,53234} => 15,
{39583,40264} => 11,...}
2> ranger:find(13765, RangeMap).
{ok,3}
3> ranger:find(137650, RangeMap).
none
65535 - upper limit of key range 16 - capacity (maximum number of subranges) [] - list of active subranges (keys from the remaining subranges will be distributed among the active ones)