From 1a68ec073f8132dfe193ca2f84929dfc6227d862 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 14 Oct 2020 17:36:32 -0700 Subject: [PATCH 1/2] Clarify the first paragraph --- Doc/library/random.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 635f9e1c032da3..b00c3342104071 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -543,11 +543,11 @@ Simulation of arrival times and service deliveries for a multiserver queue:: Recipes ------- -The default :func:`.random` returns multiples of 2⁻⁵³ in the range -*0.0 ≤ x < 1.0*. All such numbers are evenly spaced and are exactly -representable as Python floats. However, many floats in that interval -are not possible selections. For example, ``0.05954861408025609`` -isn't an integer multiple of 2⁻⁵³. +The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 +≤ x < 1.0*. All such numbers are evenly spaced and are exactly +representable as Python floats. However, many other representable +floats in that interval are not possible selections. For example, +``0.05954861408025609`` isn't an integer multiple of 2⁻⁵³. The following recipe takes a different approach. All floats in the interval are possible selections. The mantissa comes from a uniform From 19e5169b4a11d717c976cd1ac9c0280055fd1441 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 14 Oct 2020 22:40:50 -0700 Subject: [PATCH 2/2] Fix awkward line wrap. --- Doc/library/random.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/random.rst b/Doc/library/random.rst index b00c3342104071..5a9359484d11a8 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -543,8 +543,8 @@ Simulation of arrival times and service deliveries for a multiserver queue:: Recipes ------- -The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 -≤ x < 1.0*. All such numbers are evenly spaced and are exactly +The default :func:`.random` returns multiples of 2⁻⁵³ in the range +*0.0 ≤ x < 1.0*. All such numbers are evenly spaced and are exactly representable as Python floats. However, many other representable floats in that interval are not possible selections. For example, ``0.05954861408025609`` isn't an integer multiple of 2⁻⁵³.