+
    oia
                     Z    R t ^ RIt^ RIt^ RIHtHt R R ltR R ltR R ltR	 R
 lt	R# )z(Functions for generating random numbers.N)common	transformc                0    V ^8  d   QhR\         R\        /#    nbitsreturn)intbytes)formats   "n/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/rsa/randnum.py__annotate__r      s      C E     c                    \        V ^4      w  r\        P                  ! V4      pV^ 8  dN   \        \        P                  ! ^4      4      pV^V,
          ,          p\        P
                  ! RV4      V,           pV# )zReads 'nbits' random bits.

If nbits isn't a whole number of bytes, an extra byte will be appended with
only the lower bits set.
B)divmodosurandomordstructpack)r   nbytesrbits
randomdatarandomvalues   &    r   read_random_bitsr      sf     5!$MF F#J qy"**Q-(E	![[k2Z?
r   c                0    V ^8  d   QhR\         R\         /# r   r	   )r   s   "r   r   r   .   s     
 
3 
3 
r   c                v    \        V 4      p\        P                  ! V4      pV^V ^,
          ,          ,          pV# )z3Reads a random integer of approximately nbits bits.)r   r   	bytes2int)r   r   values   &  r   read_random_intr!   .   s8     "%(J
+E 
Q519ELr   c                0    V ^8  d   QhR\         R\         /# r   r   )r   s   "r   r   r   ;   s     
 
s 
s 
r   c                *    \        V 4      pV^,          # )z\Reads a random odd integer of approximately nbits bits.

>>> read_random_odd_int(512) & 1
1
)r!   )r   r    s   & r   read_random_odd_intr$   ;   s     E"E 19r   c                0    V ^8  d   QhR\         R\         /# )r   maxvaluer   r   )r   s   "r   r   r   H   s      c c r   c                    \         P                  ! V 4      p^ p \        V4      pW08:  d    V# V^
,          ^ 8X  d   V'       d
   V^,          pV^,          pK?  )zReturns a random integer x with 1 <= x <= maxvalue

May take a very long time in specific situations. If maxvalue needs N bits
to store, the closer maxvalue is to (2 ** N) - 1, the faster this function
is.
)r   bit_sizer!   )r&   r(   triesr    s   &   r   randintr*   H   sW     x(HE
) L 2:?u MH
r   )
__doc__r   r   rsar   r   r   r!   r$   r*    r   r   <module>r.      s)    / 
  !*

r   