Nim/lib
c-blake e1d5356ae9 Add ability to sample elements from openArray according to a weight array (#10072)
* Add the ability to sample elements from an openArray according to a parallel
array of weights/unnormalized probabilities (any sort of histogram, basically).
Also add a non-thread safe version for convenience.

* Address Araq comments on https://github.com/nim-lang/Nim/pull/10072

* import at top of file and space after '#'.

* Put in a check for non-zero total weight.

* Clarify constraint on `w`.

* Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating
old name and name new (openArray[T], openArray[U]) variants `sample`.

* Rename caller-provided state version of rand(openArray[T]) and also clean
up doc comments.

* Add test for new non-uniform array sampler.  3 sd bound makes it 99% likely
that it will still pass in the future if the random number generator changes.
We cannot both have a tight bound to check distribution *and* loose check to
ensure resilience to RNG changes.  (We cannot *guarantee* resilience, anyway.
There's always a small chance any test hits a legitimate random fluctuation.)
2018-12-23 12:23:20 +00:00
..
arch/x86 Coroutine rework. 2017-02-20 17:24:19 +02:00
core much simpler implementation of constant tuple declarations 2018-12-19 11:11:33 +01:00
deprecated Merge remote-tracking branch 'upstream/devel' into record-case 2018-12-13 13:59:46 +05:30
experimental fix experimental/diff documentation rendering (#9983) 2018-12-15 14:10:44 +01:00
genode Native access to Genode environment 2018-06-07 07:21:20 +02:00
genode_cpp Native access to Genode environment 2018-06-07 07:21:20 +02:00
impure Rework nil/option for nre in light of ""==nil 2018-12-11 22:15:57 +00:00
js Support only some types as JsAssoc types (#8627) 2018-11-23 15:05:15 +01:00
nintendoswitch Rewrite the memory management code for Nintendo Switch (#8169) 2018-07-05 16:33:15 +02:00
packages/docutils Moves fsmonitor into graveyard. Fixes #6718. (#9529) 2018-10-28 13:37:51 +01:00
posix Merge pull request #9862 from zevv/posix-cmsg 2018-12-05 08:11:27 +01:00
pure Add ability to sample elements from openArray according to a weight array (#10072) 2018-12-23 12:23:20 +00:00
std move diff.nim to experimental 2018-12-12 17:48:30 +01:00
system GC: avoid pathological behaviour; fixes #10040 [backport] (#10052) 2018-12-20 08:20:32 +01:00
windows appveyor: make the build green again 2018-12-22 09:47:22 +01:00
wrappers removes deprecated T/P types 2018-11-16 13:27:56 +01:00
cycle.h
nimbase.h define NIM_NIL nullptr when __cplusplus >= 201103L 2018-10-08 14:05:43 +02:00
nimrtl.nim more tests fixed 2018-11-23 11:58:29 +01:00
nimrtl.nim.cfg
prelude.nim
stdlib.nimble attempt to make the build green again 2017-01-07 02:55:15 +01:00
system.nim clarify doc for <= on tuple uses lexicographic order (#10069) 2018-12-21 22:52:28 +01:00