File: //usr/lib64/python3.6/site-packages/M2Crypto/__pycache__/BN.cpython-36.opt-1.pyc
3
x��Y� � @ sL d dl mZ d dlmZmZ ejr.d dlmZ d
dd�Zdd� Z d d
� Z
dS )� )�absolute_import)�m2�util)�Optional� c C s t j| ||�S )ah
Generate cryptographically strong random number.
:param bits: Length of random number in bits.
:param top: If -1, the most significant bit can be 0. If 0, the most
significant bit is 1, and if 1, the two most significant
bits will be 1.
:param bottom: If bottom is true, the number will be odd.
)r Zbn_rand)�bits�topZbottom� r �/usr/lib64/python3.6/BN.py�rand s r c C s
t j| �S )z�
Generate a random number in a range.
:param range: Upper limit for range.
:return: A random number in the range [0, range)
)r �
bn_rand_range)�ranger r r
�
rand_range s r c C sX ddl }|jdtdd� d}t|�}g }x$t| �D ]}||tj|� g7 }q2W dj|�S )z�
Return a random filename, which is simply a string where all
the characters are from the set [a-zA-Z0-9].
:param length: Length of filename to return.
:return: random filename string
r Nz7Don't use BN.randfname(), use tempfile methods instead.� )�
stacklevelZ?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890� )�warnings�warn�DeprecationWarning�lenr
r r �join)Zlengthr ZlettersZ
lettersLenZfname�xr r r
� randfname'