Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Barry
> On 26 Jul 2022, at 16:07, Cecil Westerhof via Python-list > wrote: > > I need to get a random integer. At first I tried it with: >from secrets import randbelow >index = randbelow(len(to_try)) > > This works perfectly, but it took some time. So I thought I try: >from random imp

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Chris Angelico
On Wed, 27 Jul 2022 at 09:28, Dennis Lee Bieber wrote: > > On Tue, 26 Jul 2022 16:38:38 +0200, Cecil Westerhof > declaimed the following: > > >I need to get a random integer. At first I tried it with: > >from secrets import randbelow > >index = randbelow(len(to_try)) > > > >This works per

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Dennis Lee Bieber
On Tue, 26 Jul 2022 23:47:59 +0200, Cecil Westerhof declaimed the following: >The new code: >from random import SystemRandom >system_random = SystemRandom() >index = system_random.randint(0, len(to_try) - 1) > >The first two statements are executed once. >The last statement I thin

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Dennis Lee Bieber
On Tue, 26 Jul 2022 16:38:38 +0200, Cecil Westerhof declaimed the following: >I need to get a random integer. At first I tried it with: >from secrets import randbelow >index = randbelow(len(to_try)) > >This works perfectly, but it took some time. So I thought I try: >from random impo

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Chris Angelico
On Wed, 27 Jul 2022 at 08:18, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list > > wrote: > >> > >> Chris Angelico writes: > >> > >> > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list > >> > wrote

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list >> > wrote: >> >> >> >> I need to get a random integer. At first I tried it with: >> >> from se

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Chris Angelico
On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list > > wrote: > >> > >> I need to get a random integer. At first I tried it with: > >> from secrets import randbelow > >> index

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list > wrote: >> >> I need to get a random integer. At first I tried it with: >> from secrets import randbelow >> index = randbelow(len(to_try)) >> >> This works perfectly, but it took some time. So I thoug

Re: Python code: brief

2022-07-26 Thread dn
On 27/07/2022 06.24, KK CHN wrote: > List , > > I have come across a difficulty to understand the code in this file. I am > unable to understand exactly what the code snippet is doing here. > > https://raw.githubusercontent.com/CODARcode/MDTrAnal/master/lib/codar/oas/MDTrSampler.py > > I am new

Python code: brief

2022-07-26 Thread KK CHN
List , I have come across a difficulty to understand the code in this file. I am unable to understand exactly what the code snippet is doing here. https://raw.githubusercontent.com/CODARcode/MDTrAnal/master/lib/codar/oas/MDTrSampler.py I am new to this type of scientific computing code snippets

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Chris Angelico
On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list wrote: > > I need to get a random integer. At first I tried it with: > from secrets import randbelow > index = randbelow(len(to_try)) > > This works perfectly, but it took some time. So I thought I try: > from random import

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Weatherby,Gerard
Absolutely. The task (“generate a random number”) is ill-defined. Want a fast random number? Use 552015933 (I just retrieved it from random.org). Want a true random number, use random.org API. (https://api.random.org/pricing). Something in between, follow approaches Stefan suggests. — Gerard

random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
I need to get a random integer. At first I tried it with: from secrets import randbelow index = randbelow(len(to_try)) This works perfectly, but it took some time. So I thought I try: from random import SystemRandom index = SystemRandom().randint(0, len(to_try) - 1) A first indic

PEP about recommended project folder layout

2022-07-26 Thread c . buhtz
Hello, I am not sure if I looked into the correct sources. I was looking in "PEP 609 – Python Packaging Authority (PyPA) Governance" [1] and the "PyPA specifications" [2]. My question in short: Is there an official document (e.g. a PEP) about a recommended layout for project folders. Looki

[RELEASE] The last 3.11 beta release (3.11.0b5) is now available

2022-07-26 Thread Pablo Galindo Salgado
Here we are. The universe. The vastness of spacetime. At the edge. The last frontier. The last beta*(conditions apply) for Python 3.11. We have defied the powerful gods of release blockers and we have won by using the required amount of ruse and subterfuge. https://www.python.org/downloads/releas

Re: My first attempt at a package.

2022-07-26 Thread Antoon Pardon
Op 25/07/2022 om 16:43 schreef Dennis Lee Bieber: On Mon, 25 Jul 2022 10:39:46 +0200, Antoon Pardon declaimed the following: Yes it is, but it doesn't answer my question: How do I create a package in which a file is built at install time. I just want to build a configuration file that will amo