From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4323 invoked from network); 24 Nov 2022 00:18:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Nov 2022 00:18:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669249115; b=RrOUh1rf71rvED9UtgQL/ONcKdYbR5CBTC4lCo4OMaPJXylpU4bKCutrb1fqgCF6Ah1QqqIVN0 gx6g2MUZgR0N7hXgx1cOSbDDKeLjQRIBSGFUpOKyxkMtorT9DVfmAIYdssLufZMQbj5uu9/T6k 1PfoDuB+pet/oELZnmDHozHUa47iHqI+DtsVKzwWco4JwKKeJWQEkFy0ZjcMK12uumtRbJZMsT aFPqxBXjUoArurTMVJKNOj3i949vO/jREVybdUiG/bTPzioAGFU8BqaBjfiPKIdEM8nH7e9trU 6rhnpquCw3ZIWXLZVuBIwDA4+FFIJLb/OtKU1bwzA6yhYQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1669249115; bh=XqCKYiQPggTxV39kr3VgeevJeTAZxp5eJS9+8O5SzBM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=a7pGZVTPkgVlzA0MdlTaFokXFFj9Z5rZuLIJFQs1MGfrng9WUpo0MkqPlyeQS/kOyWWIbMXFrp 9BMoFp5xhIZhtDZJY+5tbAKYnA6/jJoWHJBHgPgGvrS08lFK5RotJtYKbgEbXlgPuVbMUtcTg6 3muNIYn4zDCfA3k8dZaSSUbHfxDlR5g83FQZ4+8H1LFePn9JX+YKfzq+LhEt1htjobwXOlS5/k 4qY8bqWwV4yio9+skddEStqU4vvVzAyu3PgcnWrG1iKfwoBi6RVi4Q2yoNBmsimi8s+4nk+Ai2 TM4/79wqFGSLinuRDqRM9rUHx9gm5cheTbgBR0XbHmITHw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=SseSeA0W4x4O+/JboPndDJ+NXHaPLr2bsJ411SUwwsE=; b=d1KN515rsb4dlcVyFz/KY1NwcS uiFQ8hg/z51k+KXqnf/J4n5s1CzQZoKlEp2htnn/q84JpQoMGCGhisCidbmupp9xVvORHdPVpUZyu L7nHAKx2e3TeRjc6ccHIQjzaAsWFp4nvRWAVpwh38BAQ9LY1Pj+qOMTAOXHerAML1FLi0vmw6oOLb xqg6/Qgv/TUhYB4HgIJDlVxpGpF+/GnPDDzcGyr/8aE8ModQRkRT+qlMsrq4uNs7XuHZFoZVOoni1 rw3oH6ahysRnFgSsE20dvmu/CWx7eX3mZY4DRM3hFULvfGJDhBTWjZ/SyNQJijMTeo5UAiJfkqj4w Ob1YC+Ig==; Received: by zero.zsh.org with local id 1oxzwo-000Bfr-Qo; Thu, 24 Nov 2022 00:18:34 +0000 Authentication-Results: zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:54129) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oxzwa-000BKg-Nn; Thu, 24 Nov 2022 00:18:21 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 2F371320094A for ; Wed, 23 Nov 2022 19:18:19 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute2.internal (MEProxy); Wed, 23 Nov 2022 19:18:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1669249098; x=1669335498; bh=SseSeA0W4x4O+/JboPndDJ+NX HaPLr2bsJ411SUwwsE=; b=n0kRjThutCTtIdAqxvD/ZfHv7TnTogfStMn1V/Hns I8TGAG5eND9s5nEtYKJGgkrUW5HdSIl18WJXYvSDpslXI/MgeouWcavLKjRwO/F5 qcMMezswRIXgd65LB8lmgxjvW9ZcktLE/CiWgzTTTAbK6wc0IFKk1E1ox5s8ILL2 /tkMjkWzM7GKPdajuEadHTCdBN+7llp8RpSTmfRQzWfzZVLMd/BiErY1sD0dkfbC S1IjJpCQf+h43i43biwLFbi7jzQPOjjxohm6UiKiG0DyHHT8r8GUYI0PhN0jHYkt hlMnhvEB5q3UuoRStJ/yHErL4uDaSuBfDurScUyHKX/hQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1669249098; x=1669335498; bh=S seSeA0W4x4O+/JboPndDJ+NXHaPLr2bsJ411SUwwsE=; b=PGpN0KpJucmiggbl+ ffI6Tjje7LR+HVj0O0f42yd73CzmOdTyq//DZP8/I64LcwOvRjeC0meJxtiC53UI lWc6j/zlvkTkBi7nVIYsngQOToOWOnQ1xP/lA4QLCTKbMC9B+uaOvruUSj8WezgB QZtwmcFTNcAWdhAuom9XOG3aKNmRka0P1GTY8h1DOQgGtTs01xnwERe3sxp0+zsg JoKjqz0G6yfxx1fgdZ8P++Tmf4FrKZ4bK5foD27DHyIIWsavbmMaDpbuy04acfeL Ehg7/DuynGhu9BRK7hkd6AGHE0VxL8S9IZfMSX/i3hxSa7YtubuiUFjxWGe4MAXI Thd+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedriedvgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpedfffgrnhhivghlucfuhhgrhhgrfhdfuceougdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeefhfekfeevie elleehiefftdekudejledvhfdtjedtgeegvdeuffefleehhfdvgfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrsh hhrghhrghfrdhnrghmvg X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3E81F2A20080; Wed, 23 Nov 2022 19:18:18 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: <41712a61-75ab-4825-bbbc-d223823229ea@app.fastmail.com> In-Reply-To: References: <1b2cafe6-b4b5-c59a-11f3-4dbc1e99e2bc@zentaur.org> <6275a5ac-3a47-f591-7b3c-380ec4fed5ac@zentaur.org> <3423b634-a7c3-9efc-92cd-b9b995ac1c27@zentaur.org> <30a7e749-7f30-ecae-6479-a345b1682e7f@zentaur.org> <2df1001e-69a6-9785-70a6-8416fdcffd8d@zentaur.org> <0a07afaf-1194-6752-8133-8aa6b689724d@zentaur.org> <20221123203329.GP27622@tarpaulin.shahaf.local2> <869f6d65-15d2-477f-b78b-02427a0c1395@app.fastmail.com> Date: Thu, 24 Nov 2022 00:17:57 +0000 From: "Daniel Shahaf" To: zsh-workers@zsh.org Subject: Re: [PATCH] zsh/random module [UPDATED] Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 51054 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Daniel Shahaf wrote on Wed, 23 Nov 2022 23:54 +00:00: > dana wrote on Wed, 23 Nov 2022 21:42 +00:00: >> On Wed 23 Nov 2022, at 13:46, Daniel Shahaf wrote: >>> Oh, and bump that 16 to something 3 or 4 times as big, because a 1/6= 5536 >>> chance isn't really enough in a world where automated builds (CI, >>> distros' QA, etc.) is a thing. >> >> I feel like it should be very nearly impossible for a test to fail ju= st for >> randomness reasons. Maybe it's over-kill but in my draft reply to the= patch i >> was going to suggest something like this: >> >> () { >> repeat $(( 10 ** 5 )); do >> getrandom -L4 -U5 -c64 -a tmpa >> [[ $tmpa[(r)5] =3D=3D 5 ]] && return 0 >> done >> return 1 >> } >> > > No maybe about it :) > > With these parameters, the probability of a false positive is 2 to the > power of minus the overall number of iterations, i.e., 2**(-6.4 millio= n), > which is 1/[a number that has 1.9M decimal digits]. > > To be clear, it's not 1/1.9M, which is about the probability of a rand= om > Londoner being at 10 Downing Street right now. It's 1/[10 ** 1.9M], > which is about the probability of correctly guessing the genders of all > Londoners. To be clear, I don't mean guessing the gender /ratio/. I mean filling a spreadsheet with one row for each Londoner and having to guess each and every row correctly, without any information about the particular London= er. > If you converted the entire Earth's mass to CPUs and ran =C2=ABgetrand= om -L4 > -U5 -c64=C2=BB on it repeatedly until Sol died, and the CPUs all opera= ted at > 4GHz, and there were no bugs in anything, the chance of getting a sing= le > run to not return a 5 would still be something like a billion to one > (give or take several zeroes depending on CPU mass, the argument to -c, > and so on). > > That's why in practice, if a single -c64 call ever doesn't return a 5, > it's safe to assume there's a bug. > > Conversely, if you actually retain those 6.4 million iterations, what's > the probability that the outer loop will return 0 on the first iterati= on > and then a gamma ray will flip that to 0?