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 18263 invoked from network); 24 Oct 2022 13:21:21 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Oct 2022 13:21:21 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666617682; b=nJ1JPZVetAcREdTi3CL331ehtDp95Y0GmsO8//SPU0UIOz/uv6GfIRqQPMt6mJbnij6xo9zcmf Er3BP9JuRPfU9VY/x4bJV5hymts6Ezna7sn9Hrdb9foM6iSE9BvAgPQXN9YdWmzHDeU6AfM0oO 0usZJPFQl/5Hr80OXM+F7fr7Ib2+ClKGcJjX1fPsT+OTN6aa70qGtqEgTvENkKHoF2W69DjJQK cNWkm3/i6QmMgiL2idaYBd9iIo+6db+eXxCihsNgLpelzxWRUR8eLlo5jGJYHaxqEsGN3lKhEF tTzazW5zWZidIKRAmwI+pdZDN4RpLJ8hnTlFLlNQ+Dc23w==; 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=1666617682; bh=Vb1Y83pDFF++8/PWvRgYop6s/74eJ2IcmLDDyOSMnRQ=; 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=OMkI4O9WZbDk637htOEDikmXbnx7td5Gxs/MsTeJgjqtbk/PTC+KuYHKkeaLEswXIJ5TwGx4rX zYSTk77BwmuRYP/SJItwpXwVyMGgQVTYWubhVA4P+PV32AOV9Gi+CNisGxsokWfu6KAwjTPaFL hKnqjoyujzMuewBeAyGDMfX7mpL5uzaU3Nvg1psVi/GLGxkUmmXo+6d9Jj4vcafgxN7q2Sqbse bs0aS+OZ1qe1BSc7QOOuZqmVtEzYJPXrqUPFFTf42MjkH2fS4QwZxmNo07vtKKIcbRJ+wcPHYv eSWa7XadzZYrv/wEdrm5Qnkxzolr0kKmZ1IYm717AhJqLA==; 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=wWiHf1qzVa+mDeA4KB+H6ZCYcWUUdgFTcJuQDQWEMpU=; b=AFmk35vECt9yENPrgd0Z95yMKF oC46kG39NFIgGsGadoAtVa5qXp0whKGa6jLB2NBd6LelnA+1sn+9gejt63R1SOHf04kRy4qo/BWk0 2x7QehUdsA/0NIDCt0Z5mXL4sCMtubZuExLAw0Vw+Q6wswx/If70kpDuqijOh+w3fQkVlZ1GxkpBf UnbqR6DlnOxPc75Zu/39zoxhtTrYtzyi0XMsY3DvJK16eLJRldp/qemB05V6B3HkSMlrMOk8N2SES 6hgNlPZUSsMcD8eijmVJOqbMU91QpNgi0KZ8EDktZIVa2ws41BAPU0GDa7DhA+82bAOtzgPuPzo5s xuAkb44Q==; Received: by zero.zsh.org with local id 1omxOJ-00037Q-Pg; Mon, 24 Oct 2022 13:21:19 +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]:35466) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1omxNj-0002mx-09; Mon, 24 Oct 2022 13:20:45 +0000 Received: from iris.zentaur.org (localhost [127.0.0.1]) by iris.zentaur.org (Postfix) with ESMTP id 4MwwgD14lNz3wZj for ; Mon, 24 Oct 2022 13:20: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=1666617639; x=1666621240; bh=Vb1Y83pDFF++8/PWvRgYop6s/74eJ2Ic mLDDyOSMnRQ=; b=msFOqynzkWn3WVfFssQfVtsYtZkZDEW16PPCk2Xp82lXyNfA icHe8/3Tx+uYyPz5TrYBuE7dFIncDmSuVC4TCg8JJdUT5twyStXmKCINGP8VUJGM oImjUVx9tbMuqvAlH2uTxBCp10PjZw453JO2wSprVlG603luUoUznhxfMFVK2f+r V/BanS+ldcLjpR/TLZb2cPXU+9gYTD3wJHIiB2qQKzDPIWOYW621zoFp6zQtBNlh 3I0GcZhxTPaftvmr45vVBBzZAsJkzPB4n3XBh1ARqa0sXJB3Y6hvZEvU5cMd/dL7 8M80vgTjTl6xKxzFLwNAfGs1tAf/dw45Lpbvxw== 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 j2mEf8mE6Hsm for ; Mon, 24 Oct 2022 13:20:39 +0000 (UTC) Received: from [192.168.72.136] (unknown [136.50.213.220]) by iris.zentaur.org (Postfix) with ESMTPSA id 4MwwgC2X3Hz3wZb for ; Mon, 24 Oct 2022 13:20:39 +0000 (UTC) Message-ID: <08cb4c65-acd4-ba91-d82d-b8f3943aed8b@zentaur.org> Date: Mon, 24 Oct 2022 08:20:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: preliminary patch for zsh/random module Content-Language: en-US To: zsh-workers@zsh.org References: From: Clinton Bunch In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed X-Antivirus: Avast (VPS 221024-4, 10/24/2022), Outbound message X-Antivirus-Status: Clean Content-Transfer-Encoding: quoted-printable X-Seq: 50835 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 10/23/2022 11:47 PM, Bart Schaefer wrote: > On Sun, Oct 23, 2022 at 7:57 PM Clinton Bunch wro= te: >> On 10/23/2022 9:01 PM, Bart Schaefer wrote: >>> * Typo in the introductory comment. >> I'm pretty sure I've since found and changed all the instances of >> Zoltan's name. > I was referring to the spelling of "randome". > >>> Actual question: What's the use case for returning or printing a >>> block of random bytes? Why does this need to be a builtin? >> Mostly because I see constructs like read -k6 -u3 3 ... because? I did it to seed rand48.=C2=A0 Roman did it to generate a 32-bit random=20 integer.=C2=A0 Both of which are obsoleted by other parts of this module. I'm sure there are other reasons someone might want to read more or less=20 than 4 bytes of random data.=C2=A0 One that comes to mind is generating a= =20 password in a platform-independent way without assuming perl or python. > >> it would be nice to initialize an array with random numbers without >> having to use a loop to access SRANDOM n times. > But you're not filling an array with random numbers, you're filling a > string (scalar) with random bytes. Actually, it does both. > >>> Suggestion: Treat SRANDOM like SECONDS, in that you can change the >>> type from integer to floating-point. Then maybe the zrandom() math >>> function isn't needed? >> That would seem confusing to me, and too easy to forget which state yo= u >> left it in. > You make it local so you're not leaving it. > > () { > print $SECONDS; > () { > local -F SECONDS > print $SECONDS > } > print $SECONDS > } > 56 > 0.0000050000 > 56 Still seems like something you do because you can rather than because=20 it's intuitive to the user.=C2=A0 Also, your example assumes you'd only w= ant=20 to do this in a function (or wrap it in an anonymous function just for=20 this purpose) > >> zrandom was meant to be a replacement for rand48 > OK. >