%PDF- %PDF-
Direktori : /usr/lib/python3.12/__pycache__/ |
Current File : //usr/lib/python3.12/__pycache__/random.cpython-312.pyc |
� ���f{� � �^ � d Z ddlmZ ddlmZmZm Z mZm Z ddlmZmZmZmZ ddlmZmZmZ ddlmZmZ m!Z" ddl#m$Z% ddl&m'Z( dd l)m*Z+ dd l,m-Z.m/Z0 ddl1m1Z2 ddl#Z3ddl4Z4 dd l5m6Z7 g d�Z:d ed� z ed� z Z; ed� Z<d ed� z Z=dZ>de> z Z?dZ@ G d� de4j� � ZA G d� deA� ZB eA� ZCeCj� ZDeCj� ZEeCj� ZFeCj� ZGeCj� ZHeCj� ZIeCj� ZJeCj� ZKeCj� ZLeCj� ZMeCj� ZNeCj� ZOeCj� ZPeCj� ZQeCj� ZReCj� ZSeCj� ZTeCj� ZUeCj� ZVeCj� ZWeCj� ZXeCj� ZYeCj� ZZeCj� Z[d� Z\d!d�Z] e^e3d� r e3j� eCj� �� e`d k( r e]� yy# e8$ r dd l9m6Z7 Y ���w xY w)"aE Random variable generators. bytes ----- uniform bytes (values between 0 and 255) integers -------- uniform within range sequences --------- pick random element pick random sample pick weighted random sample generate random permutation distributions on the real line: ------------------------------ uniform triangular normal (Gaussian) lognormal negative exponential gamma beta pareto Weibull distributions on the circle (angles 0 to 2pi) --------------------------------------------- circular uniform von Mises discrete distributions ---------------------- binomial General notes on the underlying Mersenne Twister core generator: * The period is 2**19937-1. * It is one of the most extensively tested generators in existence. * The random() method is implemented in C, executes in a single Python step, and is, therefore, threadsafe. � )�warn)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�tau�floor�isfinite)�lgamma�fabs�log2)�urandom)�Sequence)�index)� accumulate�repeat)�bisectN)�sha512)�Random�SystemRandom�betavariate�binomialvariate�choice�choices�expovariate�gammavariate�gauss�getrandbits�getstate�lognormvariate� normalvariate� paretovariate� randbytes�randint�random� randrange�sample�seed�setstate�shuffle� triangular�uniform�vonmisesvariate�weibullvariate� g �� @� @� �?� @�5 � � c � � � e Zd ZdZdZd$d�Zd%� fd� Z� fd�Z� fd�Zd� Z d � Z d � Zd� Zd� Z d ez fd�Ze Zd� Zdefd�Zd� Zd� Zd� Zdd�d�Zd$dd d�d�Zd� Zd&d�Zd'd�Zd'd�Zd� Zd(d�Zd� Zd� Z d � Z!d!� Z"d"� Z#d)d#�Z$� xZ%S )*r a� Random number generator base class used by bound module functions. Used to instantiate instances of Random to get generators that don't share state. Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the following methods: random(), seed(), getstate(), and setstate(). Optionally, implement a getrandbits() method so that randrange() can cover arbitrarily large ranges. � Nc �4 � | j |� d| _ y)zeInitialize an instance. Optional argument x controls seeding, as for Random.seed(). N)r- � gauss_next)�self�xs �/usr/lib/python3.12/random.py�__init__zRandom.__init__~ s � � � � �!����� c � �� |dk( r�t |t t f� rpt |t � r|j d� n|}|rt |d � dz nd}t t |� D ] }d|z |z dz }� |t |� z }|dk( rdn|}n�|d k( rkt |t t t f� rPt |t � r|j � }t j |t |� j � z � }n:t |t d � t t t t t f� st d� �t �| �E |� d | _ y )a\ Initialize internal state from a seed. The only supported seed types are None, int, float, str, bytes, and bytearray. None or no argument seeds from current time or from an operating system specific randomness source if available. If *a* is an int, all bits are used. For version 2 (the default), all of the bits are used if *a* is a str, bytes, or bytearray. For version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for str and bytes generates a narrower range of seeds. r; zlatin-1r � iCB l ���� ������r: NzOThe only supported seed types are: None, int, float, str, bytes, and bytearray.)� isinstance�str�bytes�decode�ord�map�len� bytearray�encode�int� from_bytes�_sha512�digest�type�float� TypeError�superr- r? )r@ �a�versionrA �c� __class__s �rB r- zRandom.seed� s �� �$ �a�<�J�q�3��,�7�'1�!�U�';�����#��A�"#��A�a�D� �Q���A���a�[� =����k�Q�&�*<�<�� =� ��Q��K�A��2�g��1�A� ��\�j��S�%��,C�D��!�S�!��H�H�J�����q�7�1�:�#4�#4�#6�6�7�A��A��T� �C���U�I�N�O�� E� F� F� ���Q����rD c �N �� | j t �| � � | j fS )z9Return internal state; can be passed to setstate() later.)�VERSIONrY r$ r? )r@ r] s �rB r$ zRandom.getstate� s �� ��|�|�U�W�-�/����@�@rD c � �� |d }|dk( r|\ }}| _ t �| � |� y|dk( r.|\ }}| _ t d� |D � � }t �| � |� yt d|�d| j ��� �# t $ r}t |�d}~ww xY w)z:Restore internal state from object returned by getstate().r r= r: c 3 �&