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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12061 invoked from network); 24 Nov 2022 14:34:02 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Nov 2022 14:34:02 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669300442; b=mlymnjJdlGUuIG/gE+2+6fILyumcrJSGFeko9oH6oIH360e9ecwbsfalaNfdeppMC2iuQ9cd4s O0WQZ1GnZoaD0weJa+OSG64FtQfy9dGsQeZhVtAl1n5UIaOONS3KMF8jFtDGIGViZGnhRJ7h8W 0bPRgkAmA2wujgUYkoR2ZmfGeK7SkJZuS+KWaB9KueCSYeTi/TYmWuJgssaOn4dcHhej+uvzJj RTkdZiek9Njrbr3PYvawcCReCZagIhh6DUxkIsgGfd2xkRouSFEknUWIT9LTiQebBxe0g6Y9yI LTipK9+UeKr7H5GSH/P/yDOMfA4BcfdfPsW3XXAyg9dBBw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (iris.zentaur.org) smtp.remote-ip=198.58.127.206; dkim=pass header.d=zentaur.org header.s=dkim20200120 header.a=rsa-sha256; dmarc=pass header.from=zentaur.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1669300442; bh=h2c9oCK2AvwGLy/+K3es/sqkqUs2tGb1v3DfmRgcXQE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature: DKIM-Signature; b=OZbbbzqPMBa6t5QpAfZL2V/dMdlU3sXu/G4yeU3wccCUSuSkP1keXA3ukkmDepNnWM8oXF7JzX lSJ4gkqvR8+D2s8akQDMaCKkBOqJODOS4MLr4ubIYhnyu13k37Rr9nNlimUaCyc8pLEHjtGHDI ROgdXH95E4aqUli0m2miTiMXXZDyvOtRha/BetPSzF2cv2QnloxcexsM1YLyXrlkC18QysP3FV 9LizMXmNTozYfW4JpEnQwyWOVEApdiOlhPMpBxiUtB1UFwYiRIxi2HD4Lr57noJhfcfJD+tcED S12oekt28H5sMkJKYEyLsIo/IM/5MNNPaJVWuTIsU7vQQQ==; 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:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=fNCrSZSZXIPZq84NuUBYLvsKE2C7K3QSyH4DZ3eHm1M=; b=LNsQiNlxmB9c39HDDMriXwdCf4 1v6TwImZBYQuzLuLiVa+OIGDTRxwkcYJ7QykvOpFiMW0PNQ3IdTu0htGuWyoYq8/XYOp1jVZ9l/qO nYh/i+v9Z+tkS1FgAtFPFykn90hG0/7c5/lDiP0HUbPVVOrEhhqLjjj6iLGiVkTmBfQFsFEuQ4x5Z NN+a4RUt6Ytl191YLRK8uiqSlOzajYycneH2FflaDB3VmE2rY4fOYiyBjtzi7ygmvfaBbh/BMMHEI f6WBp/QTmK1uN/KrW+789OfLz6UZwkNIokJx0KvGpYBOWwH1zzaS3ypir4nJ6qzn/NtefMCRdJMJN ggomTCmQ==; Received: by zero.zsh.org with local id 1oyDIf-000CP9-AQ; Thu, 24 Nov 2022 14:34:01 +0000 Authentication-Results: zsh.org; iprev=pass (iris.zentaur.org) smtp.remote-ip=198.58.127.206; dkim=pass header.d=zentaur.org header.s=dkim20200120 header.a=rsa-sha256; dmarc=pass header.from=zentaur.org; arc=none Received: from iris.zentaur.org ([198.58.127.206]:42242) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1oyDIL-000C43-T7; Thu, 24 Nov 2022 14:33:43 +0000 Received: from iris.zentaur.org (localhost [127.0.0.1]) by iris.zentaur.org (Postfix) with ESMTP id 4NJ0q83xWbz3wZj for ; Thu, 24 Nov 2022 14:33:40 +0000 (UTC) Authentication-Results: iris.zentaur.org (amavisd-new); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=zentaur.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zentaur.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:references:to:content-language:subject:subject :user-agent:mime-version:date:date:message-id; s=dkim20200120; t=1669300419; x=1669304020; bh=h2c9oCK2AvwGLy/+K3es/sqkqUs2tGb1 v3DfmRgcXQE=; b=epr/kVBSWc1TtDEDeEOn3qWQwf4DatlVtq5jjeMDvdsZaCHS R1XTe3tNlIH9s8V4B7BRcTk2Wj+VNfFU9shclKJQfW5CIpFI+KXDLkoonk/SvsCB kanvv+dnPxZ0Vy3UQ0rj49FWxTvXqY867TJUGAtjfzJV8Pf8B3HJE+IL+C7LQxwl fAUp5KCsRrwvUgg66JlEXiyKKB+I1Ty4BloLAdk6i1UOAzwVT0ZyB0PI1SvNON6O Wq+cwQdBjE/0nESUXFWeky3BPLdVoyJsdxNodefjDLXST9TSHPjGSPAOLm1AYlcw v8gYEBRs8xiarfHdheGwvR17fQZ423VAYNYUbw== X-Virus-Scanned: amavisd-new at iris.zentaur.org Received: from iris.zentaur.org ([127.0.0.1]) by iris.zentaur.org (iris.zentaur.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ajMWLFlqFtWH for ; Thu, 24 Nov 2022 14:33:39 +0000 (UTC) Received: from [192.168.78.67] (173-207-53-93.cpe.cableone.net [173.207.53.93]) by iris.zentaur.org (Postfix) with ESMTPSA id 4NJ0q75HxBz3wZb for ; Thu, 24 Nov 2022 14:33:39 +0000 (UTC) Message-ID: Date: Thu, 24 Nov 2022 08:33:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] zsh/random module [UPDATED] Content-Language: en-US To: zsh-workers@zsh.org References: <741b77be-b679-76cc-f8ec-49c9d89323c1@zentaur.org> <1e8ea669-7a25-b321-6024-72dbc43ac023@zentaur.org> <41205a86-8aad-4821-baa4-1d2ac9bf3c5d@app.fastmail.com> <1b2cafe6-b4b5-c59a-11f3-4dbc1e99e2bc@zentaur.org> <6275a5ac-3a47-f591-7b3c-380ec4fed5ac@zentaur.org> <20221123194658.GM27622@tarpaulin.shahaf.local2> From: Clinton Bunch In-Reply-To: <20221123194658.GM27622@tarpaulin.shahaf.local2> Content-Type: text/plain; charset=UTF-8; format=flowed X-Antivirus: Avast (VPS 221124-2, 11/24/2022), Outbound message X-Antivirus-Status: Clean Content-Transfer-Encoding: quoted-printable X-Seq: 51063 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: On 11/23/2022 1:46 PM, Daniel Shahaf wrote: > Clinton Bunch wrote on Mon, Nov 07, 2022 at 18:18:15 -0600: [snip] > >> +++ b/Src/Modules/random.c >> @@ -0,0 +1,675 @@ > There's a whole bunch of orthographic issues in this file (whitespace, > punctuation, spelling, etc.). I won't point them out now since there > are bigger issues. The default color scheme in vim syntax highlighting makes comments very=20 hard to read, so I ended up not proofreading them as much as I should hav= e. The whitespace issues are due to trying to write in, for me, an=20 unnatural coding style.=C2=A0 I'm working on it.=C2=A0 I've seen inconsis= tent=20 coding styles elsewhere in the code, perhaps a code formatter should be=20 recommended with appropriate options.=C2=A0 The editconfig file is helpfu= l,=20 but doesn't work well when lines are added or=C2=A0 a new indentation lev= el=20 is required for existing code. (When writing Perl code, I'm a big fan of=20 perltidy) [snip] > >> + bool integer_out =3D false; /* boolean */ > The target audience for comments knows C. So, nuke this comment. The comment is left over from when integer_out was an int, before I was=20 told C99 was acceptable and changed it to bool.[snip] >> + /* Vailues for -U *nd -L */ >> + zulong upper =3D UINT32_MAX, lower =3D 0; >> + uint32_t diff =3D UINT32_MAX; >> + uint32_t min =3D 0, rej =3D 0; /* Reject below min and count *= / > =C2=ABrej=C2=BB is never read. It should probably be wrapped in an #ifdef DEBUG as should its intended=20 use. (I used it track how many numbers were being discarded to achieve=20 uniform distribution during debugging. I removed those statements and=20 forgot to remove the declaration.=C2=A0 I'm surprised I didn't get a warn= ing) > [snip] >> +/**/ >> +uint64_t >> +random64(void) { >> + uint64_t r; >> + >> + if(getrandom_buffer(&r,sizeof(r)) < 0) { >> + zwarn("zsh/random: Can't get sufficient random data."); >> + return 1; /* 0 will cause loop */ > Where is the docstring of random64() itself? /That/ is what determines > whether or not returning 0 would be correct. > > What loops and why? The loop in the random_real that checks for repeated zeros and=20 terminates when the exponent reaches the minimum value. [snip] > Thanks, > > Daniel >