Sir or Madam --
I would like to report what appears to be an error for the randint function on the following page:
One this page, it claims that the function returns a random integer that is "inclusive" of both of the two arguments. It states:
-
random.
randint
(a, b) Return a random integer N such that a <= N <= b
. Alias for
randrange(a, b+1)
.
I believe that this is not correct. I believe that it should say "a <= N < b"; that is, the returned random integer is inclusive of argument 1, but exclusive of the upper argument 2. I have found other python documentation that agrees with my claim that argument 2 is exclusive here:
While this error may seem trivial, it has caused quite a lot of grief for my students who are trying to randomise either 0 or 1, and it has taken me some time to realise that your documentation is the source of the flaw.
Thanks for your engagement,
Harry Witchel
---------------------------------------------
Dr. Harry Witchel
My short blog post for teaching scientific writing to students:
My book "Writing for Biomedical Sciences Students"
(published by Macmillan International Higher Education)
has just been released.
from home during covid crisis:
normally:
Discipline Leader in Physiology
Department of Neuroscience
Brighton and Sussex Medical School
UK
+44 (0) 771 284 5470 (mobile & SMS)
========================================