public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "arthur200126 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug string/4403] strfry() gives skewed distributions
Date: Thu, 09 May 2024 15:59:35 +0000	[thread overview]
Message-ID: <bug-4403-131-gy36qKKj16@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-4403-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=4403

--- Comment #12 from Mingye Wang <arthur200126 at gmail dot com> ---
The function Ravier mentions is at
https://sourceware.org/git/?p=glibc.git;a=blob;f=string/strfry.c;h=6092d4315842bd581d04a620f3621d0455929b2c;hb=HEAD.

The commit responsible is written on 2007-05-08 by Ulrich Drepper.
https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=string/strfry.c;h=a8b202d176885240d2d70d4247ae0c48b4ac51f2;hp=112dd4adb334a766f722ebca5fc52cd0e5a6dd93;hb=c306d807358c5ef73f7cd7d79e5f401c60892ca4;hpb=37f402350d24576e21f81a209e77705932f0181f

I *believe*, from visual inspection, that Drepper's version is equivalent to
Gunderson's patch:
* the len - 1 is obvious
* the j + i is rolled into the j assignment

I cannot agree with Jarno's claim in comment 2 as a result. Of course just
looking at code is very likely wrong, but at least Ravier agrees with me.

PS: if we *really* want to burn some time, we can probably talk about modulo
bias [rejection sampling] and how it does not handle strings more than 2^31
long. That would be silly though.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-05-09 15:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-4403-131@http.sourceware.org/bugzilla/>
2010-10-31 17:47 ` [Bug libc/4403] " awreece at gmail dot com
2011-07-26 17:26 ` kirill at shutemov dot name
2012-05-06 18:58 ` aj at suse dot de
2014-02-16 19:36 ` jackie.rosen at hushmail dot com
2014-05-28 19:46 ` schwab at sourceware dot org
2014-06-23  3:42 ` allachan at au1 dot ibm.com
2014-06-24  8:30 ` fweimer at redhat dot com
2014-07-13 22:00 ` coleharrisjohnson at gmail dot com
2015-08-27 22:03 ` [Bug string/4403] " jsm28 at gcc dot gnu.org
2015-09-04  7:17 ` slashtrooll at misc dot lka.org.lu
2022-03-26 22:42 ` sam at gentoo dot org
2022-09-21 17:10 ` gabravier at gmail dot com
2024-05-09 15:59 ` arthur200126 at gmail dot com [this message]
2024-05-10 18:03 ` aurelien at aurel32 dot net
2024-05-10 18:05 ` aurelien at aurel32 dot net
2024-05-10 18:38 ` schwab@linux-m68k.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-4403-131-gy36qKKj16@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).