File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 2025-XX-XX 3.5.1:
1+ 2025-07-14 3.5.1:
22-------------------
33 * optimize `util.random_p()` for `n < 100`
44 * add [Random Bitarrays](random_p.rst) documentation
Original file line number Diff line number Diff line change 11Change log
22==========
33
4+ **3.5.1 ** (2025-07-14):
5+
6+ * optimize ``util.random_p() `` for ``n < 100 ``
7+ * add `Random Bitarrays <random_p.rst >`__ documentation
8+ * add `statistical tests for random functions <../examples/test_random.py >`__
9+
10+
411**3.5.0 ** (2025-07-06):
512
613* add ``util.random_p() ``
Original file line number Diff line number Diff line change 11Reference
22=========
33
4- bitarray version: 3.5.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst >`__
4+ bitarray version: 3.5.1 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst >`__
55
66In the following, ``item `` and ``value `` are usually a single bit -
77an integer 0 or 1.
@@ -503,15 +503,18 @@ This sub-module was added in version 1.2.
503503
504504
505505``random_p(n, /, p=0.5, endian=None) `` -> bitarray
506- Return pseudo-random bitarray of length ``n ``. Each bit has probability ``p `` of
507- being 1. Equivalent to ``bitarray((random() < p for _ in range(n)), endian) ``.
508- The bitarrays are reproducible when calling Python's ``random.seed() `` with a
509- specific seed value.
506+ Return (pseudo-) random bitarray of length ``n ``. Each bit has probability ``p ``
507+ of being one (independent of any other bits). Mathematically equivalent
508+ to ``bitarray((random() < p for _ in range(n)), endian) ``, but much faster
509+ for large ``n ``. The random bitarrays are reproducible when giving
510+ Python's ``random.seed() `` with a specific seed value.
510511
511512 This function requires Python 3.12 or higher, as it depends on the standard
512513 library function ``random.binomialvariate() ``. Raises ``NotImplementedError ``
513514 when Python version is too low.
514515
516+ See also: `Random Bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/random_p.rst >`__
517+
515518 New in version 3.5
516519
517520
You can’t perform that action at this time.
0 commit comments