chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
10f6f2ba-d5b3-410d-9afb-cfd05b4950f6
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,366
supabase-export-v2
66dae72f96f76318
.. function:: getrandbits(k) Returns a non-negative Python integer with *k* random bits. This method is supplied with the Mersenne Twister generator and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ...
trusted_official_docs
CPython Docs
.. function:: getrandbits(k) Returns a non-negative Python integer with *k* random bits. This method is supplied with the Mersenne Twister generator and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ...
.. function:: getrandbits(k) Returns a non-negative Python integer with *k* random bits. This method is supplied with the Mersenne Twister generator and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
11f58e0d-f79e-4289-a85f-d22047df3086
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,487
supabase-export-v2
c781e0ab0494612b
average_arrival_interval) next_server_available = servers[0] wait = max(0.0, next_server_available - arrival_time) waits.append(wait) service_duration = max(0.0, gauss(average_service_time, stdev_service_time)) service_completed = arrival_time + wait + service_duration heapreplace(servers, service_completed) print(f'Me...
trusted_official_docs
CPython Docs
average_arrival_interval) next_server_available = servers[0] wait = max(0.0, next_server_available - arrival_time) waits.append(wait) service_duration = max(0.0, gauss(average_service_time, stdev_service_time)) service_completed = arrival_time + wait + service_duration heapreplace(servers, service_completed) print(f'Me...
average_arrival_interval) next_server_available = servers[0] wait = max(0.0, next_server_available - arrival_time) waits.append(wait) service_duration = max(0.0, gauss(average_service_time, stdev_service_time)) service_completed = arrival_time + wait + service_duration heapreplace(servers, service_completed) print(f'Me...
python, official-docs, cpython, P0
Local_Trusted_Corpus
14a0e16d-a094-4424-90e8-5367378f43ad
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,478
supabase-export-v2
383c0b513f55bbc8
31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% confidence ' f'interval from {means[5]:.1f} to {means[94]:.1f}') Example of a `resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to det...
trusted_official_docs
CPython Docs
31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% confidence ' f'interval from {means[5]:.1f} to {means[94]:.1f}') Example of a `resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to det...
31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% confidence ' f'interval from {means[5]:.1f} to {means[94]:.1f}') Example of a `resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to det...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1f67c39d-0096-4b92-8b6b-3c92d8a6bc8a
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,386
supabase-export-v2
d000ced53f9d8ae4
Return a *k* length list of unique elements chosen from the population sequence. Used for random sampling without replacement. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid ...
trusted_official_docs
CPython Docs
Return a *k* length list of unique elements chosen from the population sequence. Used for random sampling without replacement. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid ...
Return a *k* length list of unique elements chosen from the population sequence. Used for random sampling without replacement. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1f9786f1-0f17-471c-83c2-ac20b71b3c43
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,418
supabase-export-v2
45940adf5898e0a1
.. function:: gammavariate(alpha, beta) Gamma distribution. (*Not* the gamma function!) The shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale).
trusted_official_docs
CPython Docs
.. function:: gammavariate(alpha, beta) Gamma distribution. (*Not* the gamma function!) The shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale).
.. function:: gammavariate(alpha, beta) Gamma distribution. (*Not* the gamma function!) The shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale).
python, official-docs, cpython, P0
Local_Trusted_Corpus
21e82e8f-1a50-4eaa-8bdf-44b497ae9cba
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,344
supabase-export-v2
b76d7cf1a63f654e
With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower range of seeds. .. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed.
trusted_official_docs
CPython Docs
With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower range of seeds. .. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed.
With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower range of seeds. .. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed.
python, official-docs, cpython, P0
Local_Trusted_Corpus
254161d4-95de-4231-aefc-ad6409f48b99
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,389
supabase-export-v2
b56133aed46fc301
time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2], k=5)`` is equivalent to ``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``. To choose a sample from a range of integers, use a :func:`range` object as an argument. This is especially fast and spa...
trusted_official_docs
CPython Docs
time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2], k=5)`` is equivalent to ``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``. To choose a sample from a range of integers, use a :func:`range` object as an argument. This is especially fast and spa...
time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2], k=5)`` is equivalent to ``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``. To choose a sample from a range of integers, use a :func:`range` object as an argument. This is especially fast and spa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2a49e5d5-d905-476f-8062-5666ecfc92d1
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,423
supabase-export-v2
c8b086314502d7c4
also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below. Multithreading note: When two threads call this function simultaneously, it is possible that they will receive the same return value. This can ...
trusted_official_docs
CPython Docs
also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below. Multithreading note: When two threads call this function simultaneously, it is possible that they will receive the same return value. This can ...
also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below. Multithreading note: When two threads call this function simultaneously, it is possible that they will receive the same return value. This can ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2d12079a-ef1a-4e7f-9fda-5244a2bbac6a
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,383
supabase-export-v2
544e3c1363a0954d
be generated. For example, a sequence of length 2080 is the largest that can fit within the period of the Mersenne Twister random number generator. .. versionchanged:: 3.11 Removed the optional parameter *random*.
trusted_official_docs
CPython Docs
be generated. For example, a sequence of length 2080 is the largest that can fit within the period of the Mersenne Twister random number generator. .. versionchanged:: 3.11 Removed the optional parameter *random*.
be generated. For example, a sequence of length 2080 is the largest that can fit within the period of the Mersenne Twister random number generator. .. versionchanged:: 3.11 Removed the optional parameter *random*.
python, official-docs, cpython, P0
Local_Trusted_Corpus
2f6af437-d6ad-46bb-9179-b84618ee0e32
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,342
supabase-export-v2
836ebf483c3457bd
If *a* is an int, its absolute value is used directly. With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used.
trusted_official_docs
CPython Docs
If *a* is an int, its absolute value is used directly. With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used.
If *a* is an int, its absolute value is used directly. With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3171a71c-8778-4edd-99c4-dc581f5af1a7
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,539
supabase-export-v2
a43baa769321f34a
random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce $ # Random integer $ python -m random 6 6
trusted_official_docs
CPython Docs
random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce $ # Random integer $ python -m random 6 6
random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce $ # Random integer $ python -m random 6 6
python, official-docs, cpython, P0
Local_Trusted_Corpus
34d2bc2a-64d2-43c3-865a-ffd3456183ce
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,490
supabase-export-v2
0123a2b357d623f6
for Hackers <https://www.youtube.com/watch?v=Iq9DzN6mvYA>`_ a video tutorial by `Jake Vanderplas <https://us.pycon.org/2016/speaker/profile/295/>`_ on statistical analysis using just a few fundamental concepts including simulation, sampling, shuffling, and cross-validation. `Economics Simulation <https://nbviewer.org/...
trusted_official_docs
CPython Docs
for Hackers <https://www.youtube.com/watch?v=Iq9DzN6mvYA>`_ a video tutorial by `Jake Vanderplas <https://us.pycon.org/2016/speaker/profile/295/>`_ on statistical analysis using just a few fundamental concepts including simulation, sampling, shuffling, and cross-validation. `Economics Simulation <https://nbviewer.org/...
for Hackers <https://www.youtube.com/watch?v=Iq9DzN6mvYA>`_ a video tutorial by `Jake Vanderplas <https://us.pycon.org/2016/speaker/profile/295/>`_ on statistical analysis using just a few fundamental concepts including simulation, sampling, shuffling, and cross-validation. `Economics Simulation <https://nbviewer.org/...
python, official-docs, cpython, P0
Local_Trusted_Corpus
357c561c-3400-4f21-af16-50b5e32abe05
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,542
supabase-export-v2
ba34d031c130393b
$ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg $ python -m random --integer 6 3
trusted_official_docs
CPython Docs
$ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg $ python -m random --integer 6 3
$ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg $ python -m random --integer 6 3
python, official-docs, cpython, P0
Local_Trusted_Corpus
3651a242-3887-4f94-a3d1-2799c6bf6fb4
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,481
supabase-export-v2
361fe6d1637329fc
73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo) n = 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff)
trusted_official_docs
CPython Docs
73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo) n = 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff)
73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo) n = 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff)
python, official-docs, cpython, P0
Local_Trusted_Corpus
371c8891-84f0-4812-8901-a32bd7ac8bf8
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,458
supabase-export-v2
722a69e7fc68b735
number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running. Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change:
trusted_official_docs
CPython Docs
number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running. Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change:
number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running. Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change:
python, official-docs, cpython, P0
Local_Trusted_Corpus
382611ad-81a4-4fed-8507-6278f02c600e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,416
supabase-export-v2
f478b8edae1d24d9
word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to 0 if *lambd* is negative. .. versionchanged:: 3.12 Added the default value for ``lambd``.
trusted_official_docs
CPython Docs
word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to 0 if *lambd* is negative. .. versionchanged:: 3.12 Added the default value for ``lambd``.
word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to 0 if *lambd* is negative. .. versionchanged:: 3.12 Added the default value for ``lambd``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3bf8158d-0698-492e-8201-703d44100d31
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,410
supabase-export-v2
a4fad7f716a9d6b6
The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``. .. function:: triangular(low, high, mode)
trusted_official_docs
CPython Docs
The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``. .. function:: triangular(low, high, mode)
The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``. .. function:: triangular(low, high, mode)
python, official-docs, cpython, P0
Local_Trusted_Corpus
3dc44364-292a-4feb-b25d-71162ffcdc0d
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,335
supabase-export-v2
eda87c84fb5bd1b4
T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998. `Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-genera...
trusted_official_docs
CPython Docs
T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998. `Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-genera...
T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998. `Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-genera...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3fe89100-64dc-480d-98e4-d32770cd57c0
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,376
supabase-export-v2
ca2e316e86a81e49
includes integers, floats, and fractions but excludes decimals). Weights are assumed to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. For a given seed, the :func:`choices` function with equal weighting typically produces a different sequence than repeated calls to :func:`choice`. ...
trusted_official_docs
CPython Docs
includes integers, floats, and fractions but excludes decimals). Weights are assumed to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. For a given seed, the :func:`choices` function with equal weighting typically produces a different sequence than repeated calls to :func:`choice`. ...
includes integers, floats, and fractions but excludes decimals). Weights are assumed to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. For a given seed, the :func:`choices` function with equal weighting typically produces a different sequence than repeated calls to :func:`choice`. ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4288dbdd-9146-470a-87ae-7e50fe951540
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,459
supabase-export-v2
3d2fb18536e06022
Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change: * If a new seeding method is added, then a backward compatible seeder will be offered.
trusted_official_docs
CPython Docs
Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change: * If a new seeding method is added, then a backward compatible seeder will be offered.
Most of the random module's algorithms and seeding functions are subject to change across Python versions, but two aspects are guaranteed not to change: * If a new seeding method is added, then a backward compatible seeder will be offered.
python, official-docs, cpython, P0
Local_Trusted_Corpus
450a8c59-a26a-45e9-bcef-558be2259a76
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,411
supabase-export-v2
4b42eeb4bf4d7f4f
.. function:: triangular(low, high, mode) Return a random floating-point number *N* such that ``low <= N <= high`` and with the specified *mode* between those bounds. The *low* and *high* bounds default to zero and one. The *mode* argument defaults to the midpoint between the bounds, giving a symmetric distribution.
trusted_official_docs
CPython Docs
.. function:: triangular(low, high, mode) Return a random floating-point number *N* such that ``low <= N <= high`` and with the specified *mode* between those bounds. The *low* and *high* bounds default to zero and one. The *mode* argument defaults to the midpoint between the bounds, giving a symmetric distribution.
.. function:: triangular(low, high, mode) Return a random floating-point number *N* such that ``low <= N <= high`` and with the specified *mode* between those bounds. The *low* and *high* bounds default to zero and one. The *mode* argument defaults to the midpoint between the bounds, giving a symmetric distribution.
python, official-docs, cpython, P0
Local_Trusted_Corpus
458a290b-c440-483e-882a-6a95d3c567bb
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,424
supabase-export-v2
a9301678aded3ea9
thread use a different instance of the random number generator. 2) Put locks around all calls. 3) Use the slower, but thread-safe :func:`normalvariate` function instead. .. versionchanged:: 3.11 *mu* and *sigma* now have default arguments.
trusted_official_docs
CPython Docs
thread use a different instance of the random number generator. 2) Put locks around all calls. 3) Use the slower, but thread-safe :func:`normalvariate` function instead. .. versionchanged:: 3.11 *mu* and *sigma* now have default arguments.
thread use a different instance of the random number generator. 2) Put locks around all calls. 3) Use the slower, but thread-safe :func:`normalvariate` function instead. .. versionchanged:: 3.11 *mu* and *sigma* now have default arguments.
python, official-docs, cpython, P0
Local_Trusted_Corpus
45ac205c-5984-435b-a22e-ded4be45849e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,336
supabase-export-v2
c654dac76c2680b4
`Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-generator/>`_ for a compatible alternative random number generator with a long period and comparatively simple update operations. .. note:: The global random number generator and instances of :class:`Random...
trusted_official_docs
CPython Docs
`Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-generator/>`_ for a compatible alternative random number generator with a long period and comparatively simple update operations. .. note:: The global random number generator and instances of :class:`Random...
`Complementary-Multiply-with-Carry recipe <https://code.activestate.com/recipes/576707-long-period-random-number-generator/>`_ for a compatible alternative random number generator with a long period and comparatively simple update operations. .. note:: The global random number generator and instances of :class:`Random...
python, official-docs, cpython, P0
Local_Trusted_Corpus
466ae6cb-7353-4d77-8b2a-4d87999bce90
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,479
supabase-export-v2
ab4d833bf7aab86d
`resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to determine the statistical significance or `p-value <https://en.wikipedia.org/wiki/P-value>`_ of an observed difference between the effects of a drug versus a placebo:: # Example from "Statistics is Easy" by Denni...
trusted_official_docs
CPython Docs
`resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to determine the statistical significance or `p-value <https://en.wikipedia.org/wiki/P-value>`_ of an observed difference between the effects of a drug versus a placebo:: # Example from "Statistics is Easy" by Denni...
`resampling permutation test <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_ to determine the statistical significance or `p-value <https://en.wikipedia.org/wiki/P-value>`_ of an observed difference between the effects of a drug versus a placebo:: # Example from "Statistics is Easy" by Denni...
python, official-docs, cpython, P0
Local_Trusted_Corpus
52903156-9704-4b64-afa4-434f280d34b6
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,345
supabase-export-v2
6ed8d53c6260d537
.. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed. .. versionchanged:: 3.11 The *seed* must be one of the following types: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`.
trusted_official_docs
CPython Docs
.. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed. .. versionchanged:: 3.11 The *seed* must be one of the following types: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`.
.. versionchanged:: 3.2 Moved to the version 2 scheme which uses all of the bits in a string seed. .. versionchanged:: 3.11 The *seed* must be one of the following types: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
54ec9df5-82c8-48b9-9b8d-dba3806cd922
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,362
supabase-export-v2
3babf97420129711
.. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(random()*n)`` which could produce slightly uneven distributions. .. versionchanged:: 3.12 Automatic conversion of non-integer types is no longer supported. Calls such as ``ran...
trusted_official_docs
CPython Docs
.. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(random()*n)`` which could produce slightly uneven distributions. .. versionchanged:: 3.12 Automatic conversion of non-integer types is no longer supported. Calls such as ``ran...
.. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(random()*n)`` which could produce slightly uneven distributions. .. versionchanged:: 3.12 Automatic conversion of non-integer types is no longer supported. Calls such as ``ran...
python, official-docs, cpython, P0
Local_Trusted_Corpus
56e87929-7082-4c0e-83f4-1a97fe77003b
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,408
supabase-export-v2
4e9f61d4eae8f3e2
.. function:: uniform(a, b) Return a random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``.
trusted_official_docs
CPython Docs
.. function:: uniform(a, b) Return a random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``.
.. function:: uniform(a, b) Return a random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
58fac8b0-e479-4c01-936d-9c38c5a2a858
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,499
supabase-export-v2
6b731d30d63ed313
the iterable." # Result will be in set(itertools.combinations_with_replacement(iterable, r)). pool = tuple(iterable) n = len(pool) indices = sorted(random.choices(range(n), k=r)) return tuple(pool[i] for i in indices) def random_derangement(iterable): "Choose a permutation where no element stays in its original positi...
trusted_official_docs
CPython Docs
the iterable." # Result will be in set(itertools.combinations_with_replacement(iterable, r)). pool = tuple(iterable) n = len(pool) indices = sorted(random.choices(range(n), k=r)) return tuple(pool[i] for i in indices) def random_derangement(iterable): "Choose a permutation where no element stays in its original positi...
the iterable." # Result will be in set(itertools.combinations_with_replacement(iterable, r)). pool = tuple(iterable) n = len(pool) indices = sorted(random.choices(range(n), k=r)) return tuple(pool[i] for i in indices) def random_derangement(iterable): "Choose a permutation where no element stays in its original positi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5c22341c-c2f8-4819-a7e5-f92f519cce01
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,477
supabase-export-v2
c911fa4a7bb46c5b
# https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% co...
trusted_official_docs
CPython Docs
# https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% co...
# https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95] means = sorted(mean(choices(data, k=len(data))) for i in range(100)) print(f'The sample mean of {mean(data):.1f} has a 90% co...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5f127804-62dc-457c-a6a6-4feb7bee9bba
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,472
supabase-export-v2
d506a8f832bc66ac
>>> # Six roulette wheel spins (weighted sampling with replacement) >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6) ['red', 'green', 'black', 'black', 'red', 'black'] >>> # Deal 20 cards without replacement from a deck >>> # of 52 playing cards, and determine the proportion of cards >>> # with a ten-value: t...
trusted_official_docs
CPython Docs
>>> # Six roulette wheel spins (weighted sampling with replacement) >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6) ['red', 'green', 'black', 'black', 'red', 'black'] >>> # Deal 20 cards without replacement from a deck >>> # of 52 playing cards, and determine the proportion of cards >>> # with a ten-value: t...
>>> # Six roulette wheel spins (weighted sampling with replacement) >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6) ['red', 'green', 'black', 'black', 'red', 'black'] >>> # Deal 20 cards without replacement from a deck >>> # of 52 playing cards, and determine the proportion of cards >>> # with a ten-value: t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6146d251-f0a9-42fd-a5d8-1d9319e8514e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,343
supabase-export-v2
0bf25b250d7ab371
With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used. With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower ra...
trusted_official_docs
CPython Docs
With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used. With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower ra...
With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` object gets converted to an :class:`int` and all of its bits are used. With version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for :class:`str` and :class:`bytes` generates a narrower ra...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6770a05f-670d-404f-badf-2f868857db20
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,480
supabase-export-v2
a6799ddb1e2afde1
# Example from "Statistics is Easy" by Dennis Shasha and Manda Wilson from statistics import fmean as mean from random import shuffle drug = [54, 73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo)
trusted_official_docs
CPython Docs
# Example from "Statistics is Easy" by Dennis Shasha and Manda Wilson from statistics import fmean as mean from random import shuffle drug = [54, 73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo)
# Example from "Statistics is Easy" by Dennis Shasha and Manda Wilson from statistics import fmean as mean from random import shuffle drug = [54, 73, 53, 70, 73, 68, 52, 65, 65] placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46] observed_diff = mean(drug) - mean(placebo)
python, official-docs, cpython, P0
Local_Trusted_Corpus
68981700-e220-4e75-9e8b-eaa64299da16
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,340
supabase-export-v2
c1a29744327c079c
Initialize the random number generator. If *a* is omitted or ``None``, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability).
trusted_official_docs
CPython Docs
Initialize the random number generator. If *a* is omitted or ``None``, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability).
Initialize the random number generator. If *a* is omitted or ``None``, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability).
python, official-docs, cpython, P0
Local_Trusted_Corpus
6b357c54-8d20-4c28-a6af-39f113814820
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,419
supabase-export-v2
d57b5abad0bfb391
shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale). The probability distribution function is::
trusted_official_docs
CPython Docs
shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale). The probability distribution function is::
shape and scale parameters, *alpha* and *beta*, must have positive values. (Calling conventions vary and some sources define 'beta' as the inverse of the scale). The probability distribution function is::
python, official-docs, cpython, P0
Local_Trusted_Corpus
702d5d2b-918d-4165-bef7-e4ab3b916f92
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,400
supabase-export-v2
164ed1057e0da6c4
sum(random() < p for i in range(n)) The number of trials *n* should be a non-negative integer. The probability of success *p* should be between ``0.0 <= p <= 1.0``. The result is an integer in the range ``0 <= X <= n``.
trusted_official_docs
CPython Docs
sum(random() < p for i in range(n)) The number of trials *n* should be a non-negative integer. The probability of success *p* should be between ``0.0 <= p <= 1.0``. The result is an integer in the range ``0 <= X <= n``.
sum(random() < p for i in range(n)) The number of trials *n* should be a non-negative integer. The probability of success *p* should be between ``0.0 <= p <= 1.0``. The result is an integer in the range ``0 <= X <= n``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
737cc0bd-518e-45e7-81ce-d73ba3d6db4e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,476
supabase-export-v2
acb7a3ea4e748bac
Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confidence interval for the mean of a sample:: # https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices
trusted_official_docs
CPython Docs
Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confidence interval for the mean of a sample:: # https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices
Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confidence interval for the mean of a sample:: # https://www.thoughtco.com/example-of-bootstrapping-3126155 from statistics import fmean as mean from random import choices
python, official-docs, cpython, P0
Local_Trusted_Corpus
7baddb2e-0fa3-4b90-9c2c-e2d35e4a3a0a
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,426
supabase-export-v2
983478cc793831bf
.. function:: lognormvariate(mu, sigma) Log normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean *mu* and standard deviation *sigma*. *mu* can have any value, and *sigma* must be greater than zero.
trusted_official_docs
CPython Docs
.. function:: lognormvariate(mu, sigma) Log normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean *mu* and standard deviation *sigma*. *mu* can have any value, and *sigma* must be greater than zero.
.. function:: lognormvariate(mu, sigma) Log normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean *mu* and standard deviation *sigma*. *mu* can have any value, and *sigma* must be greater than zero.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7efd264e-4149-4472-aa03-0b96aa6ad21a
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,422
supabase-export-v2
b4def3f303d89c18
.. function:: gauss(mu=0.0, sigma=1.0) Normal distribution, also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below.
trusted_official_docs
CPython Docs
.. function:: gauss(mu=0.0, sigma=1.0) Normal distribution, also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below.
.. function:: gauss(mu=0.0, sigma=1.0) Normal distribution, also called the Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation. This is slightly faster than the :func:`normalvariate` function defined below.
python, official-docs, cpython, P0
Local_Trusted_Corpus
83bd3409-d4ca-451c-b356-e743faa7fc37
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,328
supabase-export-v2
b09f9229bf0f7126
extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes. The functions supplied by this module are actually bound methods of a hidden instance of the :class:`random.Random` class. You ...
trusted_official_docs
CPython Docs
extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes. The functions supplied by this module are actually bound methods of a hidden instance of the :class:`random.Random` class. You ...
extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes. The functions supplied by this module are actually bound methods of a hidden instance of the :class:`random.Random` class. You ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
848bbaf0-2199-427c-b586-d44bfa8f33df
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,491
supabase-export-v2
74fea2ee65e5ef21
Norvig <https://norvig.com/bio.html>`_ that shows effective use of many of the tools and distributions provided by this module (gauss, uniform, sample, betavariate, choice, triangular, and randrange). `A Concrete Introduction to Probability (using Python) <https://nbviewer.org/url/norvig.com/ipython/Probability.ipynb>...
trusted_official_docs
CPython Docs
Norvig <https://norvig.com/bio.html>`_ that shows effective use of many of the tools and distributions provided by this module (gauss, uniform, sample, betavariate, choice, triangular, and randrange). `A Concrete Introduction to Probability (using Python) <https://nbviewer.org/url/norvig.com/ipython/Probability.ipynb>...
Norvig <https://norvig.com/bio.html>`_ that shows effective use of many of the tools and distributions provided by this module (gauss, uniform, sample, betavariate, choice, triangular, and randrange). `A Concrete Introduction to Probability (using Python) <https://nbviewer.org/url/norvig.com/ipython/Probability.ipynb>...
python, official-docs, cpython, P0
Local_Trusted_Corpus
86a34c39-6595-4bc5-962a-1b8973142c5b
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,504
supabase-export-v2
19811bf89fe5348f
random_combination('ABCDEFG', 4) ('B', 'C', 'D', 'G') >>> random_combination('ABCDEFG', 3) ('B', 'E', 'G') >>> random_combination('ABCDEFG', 2) ('E', 'G') >>> random_combination('ABCDEFG', 1) ('C',) >>> random_combination('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_combination_with_replacement('ABCDEFG', 7) ...
trusted_official_docs
CPython Docs
random_combination('ABCDEFG', 4) ('B', 'C', 'D', 'G') >>> random_combination('ABCDEFG', 3) ('B', 'E', 'G') >>> random_combination('ABCDEFG', 2) ('E', 'G') >>> random_combination('ABCDEFG', 1) ('C',) >>> random_combination('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_combination_with_replacement('ABCDEFG', 7) ...
random_combination('ABCDEFG', 4) ('B', 'C', 'D', 'G') >>> random_combination('ABCDEFG', 3) ('B', 'E', 'G') >>> random_combination('ABCDEFG', 2) ('E', 'G') >>> random_combination('ABCDEFG', 1) ('C',) >>> random_combination('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_combination_with_replacement('ABCDEFG', 7) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8debbdae-e81e-4633-b419-c81dec650591
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,390
supabase-export-v2
e2a69846e43eaf19
range of integers, use a :func:`range` object as an argument. This is especially fast and space efficient for sampling from a large population: ``sample(range(10000000), k=60)``. If the sample size is larger than the population size, a :exc:`ValueError` is raised.
trusted_official_docs
CPython Docs
range of integers, use a :func:`range` object as an argument. This is especially fast and space efficient for sampling from a large population: ``sample(range(10000000), k=60)``. If the sample size is larger than the population size, a :exc:`ValueError` is raised.
range of integers, use a :func:`range` object as an argument. This is especially fast and space efficient for sampling from a large population: ``sample(range(10000000), k=60)``. If the sample size is larger than the population size, a :exc:`ValueError` is raised.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8e66d8df-7b58-43d6-883e-ba9391007e54
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,483
supabase-export-v2
2626c94e5c2f74e9
print(f'The one-sided p-value of {count / n:.4f} leads us to reject the null') print(f'hypothesis that there is no difference between the drug and the placebo.') Simulation of arrival times and service deliveries for a multiserver queue::
trusted_official_docs
CPython Docs
print(f'The one-sided p-value of {count / n:.4f} leads us to reject the null') print(f'hypothesis that there is no difference between the drug and the placebo.') Simulation of arrival times and service deliveries for a multiserver queue::
print(f'The one-sided p-value of {count / n:.4f} leads us to reject the null') print(f'hypothesis that there is no difference between the drug and the placebo.') Simulation of arrival times and service deliveries for a multiserver queue::
python, official-docs, cpython, P0
Local_Trusted_Corpus
8f18d305-5780-4809-a7fb-bfa97e4cdbdf
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,506
supabase-export-v2
93a96d958eca468f
('B', 'C', 'A', 'E', 'D') >>> # Identical inputs treated as distinct >>> identical = 20 >>> random_derangement((10, identical, 30, identical)) (20, 30, 10, 20) The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced and are exactly representable as Python f...
trusted_official_docs
CPython Docs
('B', 'C', 'A', 'E', 'D') >>> # Identical inputs treated as distinct >>> identical = 20 >>> random_derangement((10, identical, 30, identical)) (20, 30, 10, 20) The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced and are exactly representable as Python f...
('B', 'C', 'A', 'E', 'D') >>> # Identical inputs treated as distinct >>> identical = 20 >>> random_derangement((10, identical, 30, identical)) (20, 30, 10, 20) The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced and are exactly representable as Python f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9413fd10-643b-44de-9dea-3e999bcac427
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,327
supabase-export-v2
8f31468c5edb6994
are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available. Almost all module functions depend on the basic function :func:`.random`, which generates a random float uniformly in the ...
trusted_official_docs
CPython Docs
are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available. Almost all module functions depend on the basic function :func:`.random`, which generates a random float uniformly in the ...
are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available. Almost all module functions depend on the basic function :func:`.random`, which generates a random float uniformly in the ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
97de2aa9-52d2-4b72-92d0-ba1803c9a758
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,496
supabase-export-v2
f3fd8c855483e8e9
def random_product(*iterables, repeat=1): "Random selection from itertools.product(*iterables, repeat=repeat)" pools = tuple(map(tuple, iterables)) * repeat return tuple(map(random.choice, pools)) def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterab...
trusted_official_docs
CPython Docs
def random_product(*iterables, repeat=1): "Random selection from itertools.product(*iterables, repeat=repeat)" pools = tuple(map(tuple, iterables)) * repeat return tuple(map(random.choice, pools)) def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterab...
def random_product(*iterables, repeat=1): "Random selection from itertools.product(*iterables, repeat=repeat)" pools = tuple(map(tuple, iterables)) * repeat return tuple(map(random.choice, pools)) def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterab...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9979ca02-68ab-4562-a1fc-d8f8102d214f
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,475
supabase-export-v2
e9488438c519fde9
in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial() for i in range(10_000)) / 10_000 0.7958 Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confi...
trusted_official_docs
CPython Docs
in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial() for i in range(10_000)) / 10_000 0.7958 Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confi...
in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial() for i in range(10_000)) / 10_000 0.7958 Example of `statistical bootstrapping <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling with replacement to estimate a confi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9da67f78-dde3-48f4-bbdc-4305708b1c92
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,512
supabase-export-v2
f3ce6b4f9ef61eed
mantissa = 0x10_0000_0000_0000 | self.getrandbits(52) exponent = -53 x = 0 while not x: x = self.getrandbits(32) exponent += x.bit_length() - 32 return ldexp(mantissa, exponent) All :ref:`real valued distributions <real-valued-distributions>` in the class will use the new method::
trusted_official_docs
CPython Docs
mantissa = 0x10_0000_0000_0000 | self.getrandbits(52) exponent = -53 x = 0 while not x: x = self.getrandbits(32) exponent += x.bit_length() - 32 return ldexp(mantissa, exponent) All :ref:`real valued distributions <real-valued-distributions>` in the class will use the new method::
mantissa = 0x10_0000_0000_0000 | self.getrandbits(52) exponent = -53 x = 0 while not x: x = self.getrandbits(32) exponent += x.bit_length() - 32 return ldexp(mantissa, exponent) All :ref:`real valued distributions <real-valued-distributions>` in the class will use the new method::
python, official-docs, cpython, P0
Local_Trusted_Corpus
9e1a2e94-1d93-4cee-9571-3d5610dc2f90
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,460
supabase-export-v2
80f55416a87ade84
* If a new seeding method is added, then a backward compatible seeder will be offered. * The generator's :meth:`~Random.random` method will continue to produce the same sequence when the compatible seeder is given the same seed.
trusted_official_docs
CPython Docs
* If a new seeding method is added, then a backward compatible seeder will be offered. * The generator's :meth:`~Random.random` method will continue to produce the same sequence when the compatible seeder is given the same seed.
* If a new seeding method is added, then a backward compatible seeder will be offered. * The generator's :meth:`~Random.random` method will continue to produce the same sequence when the compatible seeder is given the same seed.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9fe86402-f714-420d-8112-422ec55bfed6
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,349
supabase-export-v2
d90c2100d8939a60
.. function:: setstate(state) *state* should have been obtained from a previous call to :func:`getstate`, and :func:`setstate` restores the internal state of the generator to what it was at the time :func:`getstate` was called.
trusted_official_docs
CPython Docs
.. function:: setstate(state) *state* should have been obtained from a previous call to :func:`getstate`, and :func:`setstate` restores the internal state of the generator to what it was at the time :func:`getstate` was called.
.. function:: setstate(state) *state* should have been obtained from a previous call to :func:`getstate`, and :func:`setstate` restores the internal state of the generator to what it was at the time :func:`getstate` was called.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a1cb142f-2410-4644-8ef1-0d7622ea6c39
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,325
supabase-export-v2
1c1bc4430ac6944f
This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.
trusted_official_docs
CPython Docs
This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.
This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a2681b46-827f-4d84-8120-9869997674d0
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,388
supabase-export-v2
68c6cd914424acba
Members of the population need not be :term:`hashable` or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. Repeated elements can be specified one at a time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2],...
trusted_official_docs
CPython Docs
Members of the population need not be :term:`hashable` or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. Repeated elements can be specified one at a time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2],...
Members of the population need not be :term:`hashable` or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. Repeated elements can be specified one at a time or with the optional keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], counts=[4, 2],...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a5f36f63-2611-42bf-8681-5fd978872127
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,486
supabase-export-v2
c327466ed7451d3a
average_arrival_interval = 5.6 average_service_time = 15.0 stdev_service_time = 3.5 num_servers = 3 waits = [] arrival_time = 0.0 servers = [0.0] * num_servers # time when each server becomes available heapify(servers) for i in range(1_000_000): arrival_time += expovariate(1.0 / average_arrival_interval) next_ser...
trusted_official_docs
CPython Docs
average_arrival_interval = 5.6 average_service_time = 15.0 stdev_service_time = 3.5 num_servers = 3 waits = [] arrival_time = 0.0 servers = [0.0] * num_servers # time when each server becomes available heapify(servers) for i in range(1_000_000): arrival_time += expovariate(1.0 / average_arrival_interval) next_ser...
average_arrival_interval = 5.6 average_service_time = 15.0 stdev_service_time = 3.5 num_servers = 3 waits = [] arrival_time = 0.0 servers = [0.0] * num_servers # time when each server becomes available heapify(servers) for i in range(1_000_000): arrival_time += expovariate(1.0 / average_arrival_interval) next_ser...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9063346-8ef9-4340-b6f9-c53f783c8c74
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,341
supabase-export-v2
219ce5e172460fd8
If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability). If *a* is an int, its absolute value is used directly.
trusted_official_docs
CPython Docs
If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability). If *a* is an int, its absolute value is used directly.
If randomness sources are provided by the operating system, they are used instead of the system time (see the :func:`os.urandom` function for details on availability). If *a* is an int, its absolute value is used directly.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a90fd89d-7fb5-4a54-8203-96d15037c45b
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,507
supabase-export-v2
423327dc193d7bf3
representable as Python floats. However, many other representable floats in that interval are not possible selections. For example, ``0.05954861408025609`` isn't an integer multiple of 2⁻⁵³. The following recipe takes a different approach. All floats in the interval are possible selections. The mantissa comes from a un...
trusted_official_docs
CPython Docs
representable as Python floats. However, many other representable floats in that interval are not possible selections. For example, ``0.05954861408025609`` isn't an integer multiple of 2⁻⁵³. The following recipe takes a different approach. All floats in the interval are possible selections. The mantissa comes from a un...
representable as Python floats. However, many other representable floats in that interval are not possible selections. For example, ``0.05954861408025609`` isn't an integer multiple of 2⁻⁵³. The following recipe takes a different approach. All floats in the interval are possible selections. The mantissa comes from a un...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ab10ee7c-c822-4cd0-862f-d514e33f4d34
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,330
supabase-export-v2
f27484d8bfb455bd
also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that class for more details. The :mod:`!random` module also provides the :class:`SystemRandom` class which uses the system function :func:`os.urandom` to generate random numbers from sources provided by the ...
trusted_official_docs
CPython Docs
also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that class for more details. The :mod:`!random` module also provides the :class:`SystemRandom` class which uses the system function :func:`os.urandom` to generate random numbers from sources provided by the ...
also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that class for more details. The :mod:`!random` module also provides the :class:`SystemRandom` class which uses the system function :func:`os.urandom` to generate random numbers from sources provided by the ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
abbd9e9a-0f39-467d-a65d-fe931496beea
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,440
supabase-export-v2
fde49e54e138d16d
.. versionchanged:: 3.11 Formerly the *seed* could be any hashable object. Now it is limited to: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`. Subclasses of :class:`!Random` should override the following methods if they wish to make use of a different basic generator:
trusted_official_docs
CPython Docs
.. versionchanged:: 3.11 Formerly the *seed* could be any hashable object. Now it is limited to: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`. Subclasses of :class:`!Random` should override the following methods if they wish to make use of a different basic generator:
.. versionchanged:: 3.11 Formerly the *seed* could be any hashable object. Now it is limited to: ``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`. Subclasses of :class:`!Random` should override the following methods if they wish to make use of a different basic generator:
python, official-docs, cpython, P0
Local_Trusted_Corpus
b432183f-8c2f-490c-a7e1-0f1cb648c1a6
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,361
supabase-export-v2
1840d09f512e95a3
Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``. .. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(rand...
trusted_official_docs
CPython Docs
Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``. .. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(rand...
Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``. .. versionchanged:: 3.2 :meth:`randrange` is more sophisticated about producing equally distributed values. Formerly it used a style like ``int(rand...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b7a01c60-923d-4b73-a81e-883dbc2d8783
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,505
supabase-export-v2
84566128ea2e2a5d
'C', 'D', 'E', 'E', 'E', 'G') >>> random_combination_with_replacement('ABCDEFG', 3) ('A', 'B', 'E') >>> random_combination_with_replacement('ABCDEFG', 2) ('A', 'G') >>> random_combination_with_replacement('ABCDEFG', 1) ('E',) >>> random_combination_with_replacement('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_...
trusted_official_docs
CPython Docs
'C', 'D', 'E', 'E', 'E', 'G') >>> random_combination_with_replacement('ABCDEFG', 3) ('A', 'B', 'E') >>> random_combination_with_replacement('ABCDEFG', 2) ('A', 'G') >>> random_combination_with_replacement('ABCDEFG', 1) ('E',) >>> random_combination_with_replacement('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_...
'C', 'D', 'E', 'E', 'E', 'G') >>> random_combination_with_replacement('ABCDEFG', 3) ('A', 'B', 'E') >>> random_combination_with_replacement('ABCDEFG', 2) ('A', 'G') >>> random_combination_with_replacement('ABCDEFG', 1) ('E',) >>> random_combination_with_replacement('ABCDEFG', 0) () >>> random.seed(8675309) >>> random_...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b83dd031-0c9b-46ec-a41d-0f3b8f18f3be
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,455
supabase-export-v2
b7f7e7a148283a63
.. class:: SystemRandom([seed]) Class that uses the :func:`os.urandom` function for generating random numbers from sources provided by the operating system. Not available on all systems. Does not rely on software state, and sequences are not reproducible. Accordingly, the :meth:`seed` method has no effect and is igno...
trusted_official_docs
CPython Docs
.. class:: SystemRandom([seed]) Class that uses the :func:`os.urandom` function for generating random numbers from sources provided by the operating system. Not available on all systems. Does not rely on software state, and sequences are not reproducible. Accordingly, the :meth:`seed` method has no effect and is igno...
.. class:: SystemRandom([seed]) Class that uses the :func:`os.urandom` function for generating random numbers from sources provided by the operating system. Not available on all systems. Does not rely on software state, and sequences are not reproducible. Accordingly, the :meth:`seed` method has no effect and is igno...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc13140a-7c9e-4cd7-adfc-64ff5d1073f9
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,482
supabase-export-v2
e2046f30a15f7450
= 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff) print(f'{n} label reshufflings produced only {count} instances with a difference') print(f'at least as extreme as the observed differ...
trusted_official_docs
CPython Docs
= 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff) print(f'{n} label reshufflings produced only {count} instances with a difference') print(f'at least as extreme as the observed differ...
= 10_000 count = 0 combined = drug + placebo for i in range(n): shuffle(combined) new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):]) count += (new_diff >= observed_diff) print(f'{n} label reshufflings produced only {count} instances with a difference') print(f'at least as extreme as the observed differ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
beac2583-eb49-4ba2-b5dc-42f6347213ed
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,503
supabase-export-v2
520a7bda815c63df
>>> random.seed(8675309) >>> random_permutation('ABCDEFG') ('D', 'B', 'E', 'C', 'G', 'A', 'F') >>> random_permutation('ABCDEFG', 5) ('A', 'G', 'D', 'C', 'B') >>> random.seed(8675309) >>> random_combination('ABCDEFG', 7) ('A', 'B', 'C', 'D', 'E', 'F', 'G') >>> random_combination('ABCDEFG', 6) ('A', 'B', 'C', 'D', 'F...
trusted_official_docs
CPython Docs
>>> random.seed(8675309) >>> random_permutation('ABCDEFG') ('D', 'B', 'E', 'C', 'G', 'A', 'F') >>> random_permutation('ABCDEFG', 5) ('A', 'G', 'D', 'C', 'B') >>> random.seed(8675309) >>> random_combination('ABCDEFG', 7) ('A', 'B', 'C', 'D', 'E', 'F', 'G') >>> random_combination('ABCDEFG', 6) ('A', 'B', 'C', 'D', 'F...
>>> random.seed(8675309) >>> random_permutation('ABCDEFG') ('D', 'B', 'E', 'C', 'G', 'A', 'F') >>> random_permutation('ABCDEFG', 5) ('A', 'G', 'D', 'C', 'B') >>> random.seed(8675309) >>> random_combination('ABCDEFG', 7) ('A', 'B', 'C', 'D', 'E', 'F', 'G') >>> random_combination('ABCDEFG', 6) ('A', 'B', 'C', 'D', 'F...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c3ce1b92-a8a7-4f36-aa15-d76d9d3c3432
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,360
supabase-export-v2
5d9f07877eaad9dc
The positional argument pattern matches the :func:`range` function. Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``.
trusted_official_docs
CPython Docs
The positional argument pattern matches the :func:`range` function. Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``.
The positional argument pattern matches the :func:`range` function. Keyword arguments should not be used because they can be interpreted in unexpected ways. For example ``randrange(start=100)`` is interpreted as ``randrange(0, 100, 1)``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c742095f-30df-4954-8950-1b934050ae4e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,326
supabase-export-v2
3581d7a4a08e4fce
uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement. On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distr...
trusted_official_docs
CPython Docs
uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement. On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distr...
uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement. On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c772fe84-e125-4f85-90c2-d909f7f828b8
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,415
supabase-export-v2
c71eedfddfd2cdb6
.. function:: expovariate(lambd = 1.0) Exponential distribution. *lambd* is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to ...
trusted_official_docs
CPython Docs
.. function:: expovariate(lambd = 1.0) Exponential distribution. *lambd* is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to ...
.. function:: expovariate(lambd = 1.0) Exponential distribution. *lambd* is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if *lambd* is positive, and from negative infinity to ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c860afa2-9277-4de2-991c-306cda874da6
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,334
supabase-export-v2
3d55cf322f68fed8
.. seealso:: M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998.
trusted_official_docs
CPython Docs
.. seealso:: M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998.
.. seealso:: M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8e76514-889f-4cf9-bf78-2c4372bb5bea
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,382
supabase-export-v2
bf500d4503c34936
To shuffle an immutable sequence and return a new shuffled list, use ``sample(x, k=len(x))`` instead. Note that even for small ``len(x)``, the total number of permutations of *x* can quickly grow larger than the period of most random number generators. This implies that most permutations of a long sequence can never b...
trusted_official_docs
CPython Docs
To shuffle an immutable sequence and return a new shuffled list, use ``sample(x, k=len(x))`` instead. Note that even for small ``len(x)``, the total number of permutations of *x* can quickly grow larger than the period of most random number generators. This implies that most permutations of a long sequence can never b...
To shuffle an immutable sequence and return a new shuffled list, use ``sample(x, k=len(x))`` instead. Note that even for small ``len(x)``, the total number of permutations of *x* can quickly grow larger than the period of most random number generators. This implies that most permutations of a long sequence can never b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9f60387-dc23-487f-ab9b-6846ceee1af3
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,404
supabase-export-v2
ea8bb0ba6cefef3a
Real-valued distributions ------------------------- The following functions generate specific real-valued distributions. Function parameters are named after the corresponding variables in the distribution's equation, as used in common mathematical practice; most of these equations can be found in any statistics text.
trusted_official_docs
CPython Docs
Real-valued distributions ------------------------- The following functions generate specific real-valued distributions. Function parameters are named after the corresponding variables in the distribution's equation, as used in common mathematical practice; most of these equations can be found in any statistics text.
Real-valued distributions ------------------------- The following functions generate specific real-valued distributions. Function parameters are named after the corresponding variables in the distribution's equation, as used in common mathematical practice; most of these equations can be found in any statistics text.
python, official-docs, cpython, P0
Local_Trusted_Corpus
cc4708a2-ecd3-45d9-a90a-b5a9f311ae28
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,329
supabase-export-v2
7d0dc8f6fee4ff5b
bound methods of a hidden instance of the :class:`random.Random` class. You can instantiate your own instances of :class:`Random` to get generators that don't share state. Class :class:`Random` can also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that clas...
trusted_official_docs
CPython Docs
bound methods of a hidden instance of the :class:`random.Random` class. You can instantiate your own instances of :class:`Random` to get generators that don't share state. Class :class:`Random` can also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that clas...
bound methods of a hidden instance of the :class:`random.Random` class. You can instantiate your own instances of :class:`Random` to get generators that don't share state. Class :class:`Random` can also be subclassed if you want to use a different basic generator of your own devising: see the documentation on that clas...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cfb1e300-3312-4cab-9b87-2ed4539de41e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,367
supabase-export-v2
bbf6f2c772e47916
and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges. .. versionchanged:: 3.9 This method now accepts zero for *k*.
trusted_official_docs
CPython Docs
and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges. .. versionchanged:: 3.9 This method now accepts zero for *k*.
and some other generators may also provide it as an optional part of the API. When available, :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges. .. versionchanged:: 3.9 This method now accepts zero for *k*.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2f7deb3-cd76-4110-81fe-1c0e130510d2
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,469
supabase-export-v2
756638bce83fb44b
>>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three'] >>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement [40, 10, 50, 30]
trusted_official_docs
CPython Docs
>>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three'] >>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement [40, 10, 50, 30]
>>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three'] >>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement [40, 10, 50, 30]
python, official-docs, cpython, P0
Local_Trusted_Corpus
d7f6e7c0-df43-4c21-bc7f-994115293850
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,409
supabase-export-v2
af1ea96bf13ab4f5
random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``.
trusted_official_docs
CPython Docs
random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``.
random floating-point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. The end-point value ``b`` may or may not be included in the range depending on floating-point rounding in the expression ``a + (b-a) * random()``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d81a0e8c-7865-485a-a4df-81caac6ee426
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,374
supabase-export-v2
42a0bdb38e9c6973
cumulative weights ``[10, 15, 45, 50]``. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work. If neither *weights* nor *cum_weights* are specified, selections are made with equal probability. If a weights sequence is supplied, it...
trusted_official_docs
CPython Docs
cumulative weights ``[10, 15, 45, 50]``. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work. If neither *weights* nor *cum_weights* are specified, selections are made with equal probability. If a weights sequence is supplied, it...
cumulative weights ``[10, 15, 45, 50]``. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work. If neither *weights* nor *cum_weights* are specified, selections are made with equal probability. If a weights sequence is supplied, it...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e53d16b9-c698-473b-919c-d70a344db785
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,468
supabase-export-v2
0d468a059f3ea97e
>>> choice(['win', 'lose', 'draw']) # Single random element from a sequence 'draw' >>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three']
trusted_official_docs
CPython Docs
>>> choice(['win', 'lose', 'draw']) # Single random element from a sequence 'draw' >>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three']
>>> choice(['win', 'lose', 'draw']) # Single random element from a sequence 'draw' >>> deck = 'ace two three four'.split() >>> shuffle(deck) # Shuffle a list >>> deck ['four', 'two', 'ace', 'three']
python, official-docs, cpython, P0
Local_Trusted_Corpus
e555634a-cfbe-4ca9-966a-aac2f8eedb61
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,514
supabase-export-v2
4a66dd0dee30091c
>>> fr = FullRandom() >>> fr.random() 0.05954861408025609 >>> fr.expovariate(0.25) 8.87925541791544 The recipe is conceptually equivalent to an algorithm that chooses from all the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced, but most have to be rounded down to the nearest repres...
trusted_official_docs
CPython Docs
>>> fr = FullRandom() >>> fr.random() 0.05954861408025609 >>> fr.expovariate(0.25) 8.87925541791544 The recipe is conceptually equivalent to an algorithm that chooses from all the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced, but most have to be rounded down to the nearest repres...
>>> fr = FullRandom() >>> fr.random() 0.05954861408025609 >>> fr.expovariate(0.25) 8.87925541791544 The recipe is conceptually equivalent to an algorithm that chooses from all the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are evenly spaced, but most have to be rounded down to the nearest repres...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e7d00119-a095-4dd7-85fd-54ae3c272e27
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,498
supabase-export-v2
a0769082e5953d05
def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n = len(pool) indices = sorted(random.sample(range(n), r)) return tuple(pool[i] for i in indices) def random_combination_with_replacement(iterable, r): "Choose r elements with replacement. Order the ...
trusted_official_docs
CPython Docs
def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n = len(pool) indices = sorted(random.sample(range(n), r)) return tuple(pool[i] for i in indices) def random_combination_with_replacement(iterable, r): "Choose r elements with replacement. Order the ...
def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n = len(pool) indices = sorted(random.sample(range(n), r)) return tuple(pool[i] for i in indices) def random_combination_with_replacement(iterable, r): "Choose r elements with replacement. Order the ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ea316dff-dbbb-4d67-8871-841f4fbca95e
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,473
supabase-export-v2
e7e3d223d1d5201f
cards >>> # with a ten-value: ten, jack, queen, or king. >>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20) >>> deal.count('tens') / 20 0.15 >>> # Estimate the probability of getting 5 or more heads from 7 spins >>> # of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0...
trusted_official_docs
CPython Docs
cards >>> # with a ten-value: ten, jack, queen, or king. >>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20) >>> deal.count('tens') / 20 0.15 >>> # Estimate the probability of getting 5 or more heads from 7 spins >>> # of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0...
cards >>> # with a ten-value: ten, jack, queen, or king. >>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20) >>> deal.count('tens') / 20 0.15 >>> # Estimate the probability of getting 5 or more heads from 7 spins >>> # of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eabb3215-c4ba-4b24-a880-20a53694924a
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,457
supabase-export-v2
cb2384fb908801dd
Notes on Reproducibility ------------------------ Sometimes it is useful to be able to reproduce the sequences given by a pseudo-random number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running.
trusted_official_docs
CPython Docs
Notes on Reproducibility ------------------------ Sometimes it is useful to be able to reproduce the sequences given by a pseudo-random number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running.
Notes on Reproducibility ------------------------ Sometimes it is useful to be able to reproduce the sequences given by a pseudo-random number generator. By reusing a seed value, the same sequence should be reproducible from run to run as long as multiple threads are not running.
python, official-docs, cpython, P0
Local_Trusted_Corpus
eedb45c8-b9af-461a-9f2f-8225dc0a26e4
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,538
supabase-export-v2
ce567a8c841018b9
.. code-block:: console $ # Choose one at random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce
trusted_official_docs
CPython Docs
.. code-block:: console $ # Choose one at random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce
.. code-block:: console $ # Choose one at random $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" Lobster Thermidor aux crevettes with a Mornay sauce
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef3d86c4-74f8-4ad8-abd9-8e9449de16ec
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,373
supabase-export-v2
6561175924edd638
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises :exc:`IndexError`. If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum_weights* sequence is given, the selections are made according...
trusted_official_docs
CPython Docs
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises :exc:`IndexError`. If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum_weights* sequence is given, the selections are made according...
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises :exc:`IndexError`. If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum_weights* sequence is given, the selections are made according...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3af109c-346e-4624-9733-a1a7a16522eb
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,431
supabase-export-v2
495c77fda797bd73
.. function:: vonmisesvariate(mu, kappa) *mu* is the mean angle, expressed in radians between 0 and 2\*\ *pi*, and *kappa* is the concentration parameter, which must be greater than or equal to zero. If *kappa* is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2\*\ *pi*.
trusted_official_docs
CPython Docs
.. function:: vonmisesvariate(mu, kappa) *mu* is the mean angle, expressed in radians between 0 and 2\*\ *pi*, and *kappa* is the concentration parameter, which must be greater than or equal to zero. If *kappa* is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2\*\ *pi*.
.. function:: vonmisesvariate(mu, kappa) *mu* is the mean angle, expressed in radians between 0 and 2\*\ *pi*, and *kappa* is the concentration parameter, which must be greater than or equal to zero. If *kappa* is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2\*\ *pi*.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f57f7c63-3f25-4076-a466-890620807f8f
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,497
supabase-export-v2
9ca0664a0fbc097e
def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterable) r = len(pool) if r is None else r return tuple(random.sample(pool, r)) def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n...
trusted_official_docs
CPython Docs
def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterable) r = len(pool) if r is None else r return tuple(random.sample(pool, r)) def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n...
def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" pool = tuple(iterable) r = len(pool) if r is None else r return tuple(random.sample(pool, r)) def random_combination(iterable, r): "Random selection from itertools.combinations(iterable, r)" pool = tuple(iterable) n...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f8668804-8fd3-41fc-bc4a-f012f9abcfe3
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,474
supabase-export-v2
5e6ac3fcbc0ccfcb
# of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000 0.4169 >>> # Probability of the median of 5 samples being in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial()...
trusted_official_docs
CPython Docs
# of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000 0.4169 >>> # Probability of the median of 5 samples being in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial()...
# of a biased coin that settles on heads 60% of the time. >>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000 0.4169 >>> # Probability of the median of 5 samples being in middle two quartiles >>> def trial(): ... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500 ... >>> sum(trial()...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f935d7e6-1732-45fc-976e-c4325ae6cb33
CPython Docs
file://datasets/cpython/Doc/library/random.rst
unknown
184389ff-a8ac-467d-8c5d-8264b2e6fd8d
19,541
supabase-export-v2
978871516e15bf76
$ # Random floating-point number $ python -m random 1.8 1.7080016272295635 $ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg
trusted_official_docs
CPython Docs
$ # Random floating-point number $ python -m random 1.8 1.7080016272295635 $ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg
$ # Random floating-point number $ python -m random 1.8 1.7080016272295635 $ # With explicit arguments $ python -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce" egg
python, official-docs, cpython, P0
Local_Trusted_Corpus
2ee6e6bc-9878-49e1-83fc-62b1f912018f
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,614
supabase-export-v2
6375a905365a0774
import sys import trace # create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1)
trusted_official_docs
CPython Docs
import sys import trace # create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1)
import sys import trace # create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1)
python, official-docs, cpython, P0
Local_Trusted_Corpus
32a261cc-ace5-4984-ab38-bf80820b7cb1
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,603
supabase-export-v2
b1835fbd9bcb7dab
.. method:: results() Return a :class:`CoverageResults` object that contains the cumulative results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the given :class:`Trace` instance. Does not reset the accumulated trace results.
trusted_official_docs
CPython Docs
.. method:: results() Return a :class:`CoverageResults` object that contains the cumulative results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the given :class:`Trace` instance. Does not reset the accumulated trace results.
.. method:: results() Return a :class:`CoverageResults` object that contains the cumulative results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the given :class:`Trace` instance. Does not reset the accumulated trace results.
python, official-docs, cpython, P0
Local_Trusted_Corpus
53280b49-4653-4e9e-a3a2-403920122888
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,598
supabase-export-v2
ebf694eb4ef3d359
command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`. .. method:: runctx(cmd, globals=None, locals=None)
trusted_official_docs
CPython Docs
command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`. .. method:: runctx(cmd, globals=None, locals=None)
command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`. .. method:: runctx(cmd, globals=None, locals=None)
python, official-docs, cpython, P0
Local_Trusted_Corpus
57645604-1c5e-4c22-add0-f1b3f969cc51
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,597
supabase-export-v2
44636ea8024de3b8
.. method:: run(cmd) Execute the command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`.
trusted_official_docs
CPython Docs
.. method:: run(cmd) Execute the command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`.
.. method:: run(cmd) Execute the command and gather statistics from the execution with the current tracing parameters. *cmd* must be a string or code object, suitable for passing into :func:`exec`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5dfe84ec-aea0-4ce9-9f86-d2671f5cf926
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,609
supabase-export-v2
85c46c84ee709f77
.. method:: write_results(show_missing=True, summary=False, coverdir=None,\ *, ignore_missing_files=False) Write coverage results. Set *show_missing* to show lines that had no hits. Set *summary* to include in the output the coverage summary per module. *coverdir* specifies the directory into which the coverage resu...
trusted_official_docs
CPython Docs
.. method:: write_results(show_missing=True, summary=False, coverdir=None,\ *, ignore_missing_files=False) Write coverage results. Set *show_missing* to show lines that had no hits. Set *summary* to include in the output the coverage summary per module. *coverdir* specifies the directory into which the coverage resu...
.. method:: write_results(show_missing=True, summary=False, coverdir=None,\ *, ignore_missing_files=False) Write coverage results. Set *show_missing* to show lines that had no hits. Set *summary* to include in the output the coverage summary per module. *coverdir* specifies the directory into which the coverage resu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6a4acc23-ca6d-4750-b814-11a14e29f928
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,589
supabase-export-v2
2034b930810312be
.. option:: --ignore-module=<mod> Ignore each of the given module names and its submodules (if it is a package). The argument can be a list of names separated by a comma.
trusted_official_docs
CPython Docs
.. option:: --ignore-module=<mod> Ignore each of the given module names and its submodules (if it is a package). The argument can be a list of names separated by a comma.
.. option:: --ignore-module=<mod> Ignore each of the given module names and its submodules (if it is a package). The argument can be a list of names separated by a comma.
python, official-docs, cpython, P0
Local_Trusted_Corpus
92970a09-ccde-4600-bd39-6bd0750e6c5d
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,550
supabase-export-v2
f53af8685563aefa
-------------- The :mod:`!trace` module allows you to trace program execution, generate annotated statement coverage listings, print caller/callee relationships and list functions executed during a program run. It can be used in another program or from the command line.
trusted_official_docs
CPython Docs
-------------- The :mod:`!trace` module allows you to trace program execution, generate annotated statement coverage listings, print caller/callee relationships and list functions executed during a program run. It can be used in another program or from the command line.
-------------- The :mod:`!trace` module allows you to trace program execution, generate annotated statement coverage listings, print caller/callee relationships and list functions executed during a program run. It can be used in another program or from the command line.
python, official-docs, cpython, P0
Local_Trusted_Corpus
94a1a930-5308-468f-b338-47255ab5d288
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,582
supabase-export-v2
7486ed5905ae397f
.. option:: -R, --no-report Do not generate annotated listings. This is useful if you intend to make several runs with :option:`--count <-c>`, and then produce a single set of annotated listings at the end.
trusted_official_docs
CPython Docs
.. option:: -R, --no-report Do not generate annotated listings. This is useful if you intend to make several runs with :option:`--count <-c>`, and then produce a single set of annotated listings at the end.
.. option:: -R, --no-report Do not generate annotated listings. This is useful if you intend to make several runs with :option:`--count <-c>`, and then produce a single set of annotated listings at the end.
python, official-docs, cpython, P0
Local_Trusted_Corpus
aa7a4140-0983-4e22-853d-55e9d75cd584
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,600
supabase-export-v2
6482fe1d984f7c68
from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries. .. method:: runfunc(func, /, *args, **kwds)
trusted_official_docs
CPython Docs
from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries. .. method:: runfunc(func, /, *args, **kwds)
from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries. .. method:: runfunc(func, /, *args, **kwds)
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8609f1f-7220-41f5-86a5-9b48b77fc9a9
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,610
supabase-export-v2
87b9b2ea64cd1bc6
specifies the directory into which the coverage result files will be output. If ``None``, the results for each source file are placed in its directory. If *ignore_missing_files* is ``True``, coverage counts for files that no longer exist are silently ignored. Otherwise, a missing file will raise a :exc:`FileNotFoundE...
trusted_official_docs
CPython Docs
specifies the directory into which the coverage result files will be output. If ``None``, the results for each source file are placed in its directory. If *ignore_missing_files* is ``True``, coverage counts for files that no longer exist are silently ignored. Otherwise, a missing file will raise a :exc:`FileNotFoundE...
specifies the directory into which the coverage result files will be output. If ``None``, the results for each source file are placed in its directory. If *ignore_missing_files* is ``True``, coverage counts for files that no longer exist are silently ignored. Otherwise, a missing file will raise a :exc:`FileNotFoundE...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ca08f44e-5687-4f9a-9472-21abd739d674
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,595
supabase-export-v2
a16b98bb2704b5ec
.. class:: Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(),\ ignoredirs=(), infile=None, outfile=None, timing=False) Create an object to trace execution of a single statement or expression. All parameters are optional. *count* enables counting of line numbers. *trace* enables line execution tracin...
trusted_official_docs
CPython Docs
.. class:: Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(),\ ignoredirs=(), infile=None, outfile=None, timing=False) Create an object to trace execution of a single statement or expression. All parameters are optional. *count* enables counting of line numbers. *trace* enables line execution tracin...
.. class:: Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(),\ ignoredirs=(), infile=None, outfile=None, timing=False) Create an object to trace execution of a single statement or expression. All parameters are optional. *count* enables counting of line numbers. *trace* enables line execution tracin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d18b5299-1588-4b75-af76-48cde2035696
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,599
supabase-export-v2
06e7db2871fb1c1d
.. method:: runctx(cmd, globals=None, locals=None) Execute the command and gather statistics from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries.
trusted_official_docs
CPython Docs
.. method:: runctx(cmd, globals=None, locals=None) Execute the command and gather statistics from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries.
.. method:: runctx(cmd, globals=None, locals=None) Execute the command and gather statistics from the execution with the current tracing parameters, in the defined global and local environments. If not defined, *globals* and *locals* default to empty dictionaries.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e1642522-62c4-413b-b6d6-6d63a6192586
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,564
supabase-export-v2
bab95bd8215fa205
.. option:: -c, --count Produce a set of annotated listing files upon program completion that shows how many times each statement was executed. See also :option:`--coverdir <-C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below.
trusted_official_docs
CPython Docs
.. option:: -c, --count Produce a set of annotated listing files upon program completion that shows how many times each statement was executed. See also :option:`--coverdir <-C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below.
.. option:: -c, --count Produce a set of annotated listing files upon program completion that shows how many times each statement was executed. See also :option:`--coverdir <-C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e6252e7e-feba-449c-8482-7107ad518708
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,615
supabase-export-v2
7c1eec93e7661071
a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1) # run the new command using the given tracer tracer.run('main()')
trusted_official_docs
CPython Docs
a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1) # run the new command using the given tracer tracer.run('main()')
a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace( ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1) # run the new command using the given tracer tracer.run('main()')
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef2d894f-dc8d-470e-b55c-6d4fdf33443b
CPython Docs
file://datasets/cpython/Doc/library/trace.rst
unknown
c1c92aac-e3b0-4b94-b83b-d3b520e5a639
19,562
supabase-export-v2
75287820af04d3a7
Main options ^^^^^^^^^^^^ At least one of the following options must be specified when invoking :mod:`!trace`. The :option:`--listfuncs <-l>` option is mutually exclusive with the :option:`--trace <-t>` and :option:`--count <-c>` options. When :option:`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :...
trusted_official_docs
CPython Docs
Main options ^^^^^^^^^^^^ At least one of the following options must be specified when invoking :mod:`!trace`. The :option:`--listfuncs <-l>` option is mutually exclusive with the :option:`--trace <-t>` and :option:`--count <-c>` options. When :option:`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :...
Main options ^^^^^^^^^^^^ At least one of the following options must be specified when invoking :mod:`!trace`. The :option:`--listfuncs <-l>` option is mutually exclusive with the :option:`--trace <-t>` and :option:`--count <-c>` options. When :option:`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0465d01f-eb69-4b30-a519-9dde434d958c
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.rst
unknown
51e3f59f-684e-4338-82cc-c2f09b013811
19,634
supabase-export-v2
2bc601222688de24
Similar to :func:`parse`, but parses from a buffer *string* received as a parameter. *string* must be a :class:`str` instance or a :term:`bytes-like object`. .. versionchanged:: 3.5 Added support of :class:`str` instances.
trusted_official_docs
CPython Docs
Similar to :func:`parse`, but parses from a buffer *string* received as a parameter. *string* must be a :class:`str` instance or a :term:`bytes-like object`. .. versionchanged:: 3.5 Added support of :class:`str` instances.
Similar to :func:`parse`, but parses from a buffer *string* received as a parameter. *string* must be a :class:`str` instance or a :term:`bytes-like object`. .. versionchanged:: 3.5 Added support of :class:`str` instances.
python, official-docs, cpython, P0
Local_Trusted_Corpus