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,HTML_MESSAGE,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3977 invoked from network); 28 Nov 2022 16:38:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Nov 2022 16:38:23 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669653503; b=JKIH2zEtiuvOHRpysg4FDrtasQaA7R5lVMfF1HnxRHMdunH1iOIuoQCQ2ok9ztiC5NSdrzXzAn UBmziJjmj0Ll7kbsoKwPUzo4wYgYZxGeVj7RLz1F/DCE+E8ltkhJcyRZcPwmV1m2+isTELfau2 FtchIR0WrQALmPOUyhhQW2b9e3GyqwU9sqafhcwmV4oWhLdueeCexk1jEDnP983PJhxRJ1PGO1 3liTDfBT9wu1TvU60WoOS3Lyow4U6E9ApL2cnFKcRg+O0O0uzP6oLE9yDhxIjk3JoA+molEW8c z69DdT2YNxcinSC1kuISxT87RAz+3jpR4gkGX5I/rp6gVg==; 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=1669653503; bh=zFhUuULXVekB68KnUYnem7zdd5T/ir1uosZ0K5D/1Vk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature:DKIM-Signature; b=BRV6ewC1VjXsNLzTeOypfpgn23qKurEgCAh5/VTCvHuN2DjfR6YG7yjKZBSp+GuvcNXnMSUnv+ 71/bUvp3VTFp90duShngub2M+0CMpbJtqP6oB9hm3CN4AB5x+9osxqnpUZ4igQRTGbUB6oG0uv J7dxZqKiUH6OUnxSa9jqR6sezTXb/vuJmxBh6CC8PMwSUeqjRgWP6F1/9lBLoOmUtU7uyEVzlM Gu2gIuybbYASVawwKuK8Qoqvp3BDFIcSki40ZNMNIv6M+hLaqHr898ltQNBkLaY3YOySo/tSLK UTNKlx1df7Y5whcY/AFqpPIT1aHDqccRT9kdwdx3mBuYeg==; 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:In-Reply-To:From:References:To: Subject:MIME-Version:Date:Message-ID:Content-Type:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=AMIbKbwyJA0FtO2T3S4xSq+8O33ihbhFXtUadnJE72E=; b=PjEw/4G5l4frGdK14T1Pf0YW+L zYPmEWqs/Q2bi2TmNjKC1O7ftEf4mr7JSqSM8y+Ci0PvdzeYqNU8GMmJBZ4ZRoA2vCY0fABOp7Sk6 v09AkfpIBa9JKVz/mri48bRqiwxDPHnqiKNN8CYD+Rcr7FplU5dqc6ykV7wDafZIWCp1HJBtUi2OG l+odaX7nZcwLfLyKysGFVVCBApMUGqnrOjTVsaJmDl6JGeT8TaN/e1dYyFjFCl3jW+hi/nV8KrHSX KCBnhk0XcGkTDV3caYWSwPeHfjyHmhdxr11Ca6l0dmBKGZ/e8GnWADGrS1cIjjpXjB1V4+Jkjmeg+ du6MRHFg==; Received: by zero.zsh.org with local id 1ozh9D-000IKj-87; Mon, 28 Nov 2022 16:38:23 +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]:33496) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1ozh8b-000Hzt-7D; Mon, 28 Nov 2022 16:37:47 +0000 Received: from iris.zentaur.org (localhost [127.0.0.1]) by iris.zentaur.org (Postfix) with ESMTP id 4NLWNR6rVNz3wZj for ; Mon, 28 Nov 2022 16:37:43 +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= in-reply-to:from:from:references:to:content-language:subject :subject:user-agent:mime-version:date:date:message-id :content-type:content-type; s=dkim20200120; t=1669653463; x= 1669657064; bh=zFhUuULXVekB68KnUYnem7zdd5T/ir1uosZ0K5D/1Vk=; b=e VsHsjDWSYu/9uFT2zZumwTbsfoGP45s/xiMsJK3ec96qtPsySKl6UU/Kbzz2/I/f KWmZFIrvVoVwK1D4qI7e6k8i0FsZwwH6s8lD19ol7bsGRhkvrsaGsCb7F84PhJwo JYKkASNSsLM5vnjowJ3qYr5GC+GVZ5rO5GiHZflI1FvRsm4TCd3G7DWDy2qxFTIW biccjXRYbYaNLKJT/1ibRB29UiP3jDnTsnJJCiTEJGiUVUW+ba3asDyEgPg5Onrr 5peenzeKlXpQqiLJKclf1qVaIEjQvI5g+JzcD7yW5lguvXl7X5WzfMdga8NolnGI y/Unh+Pdwi6Z0u8O+0V5A== 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 DzUASbAE0kGF for ; Mon, 28 Nov 2022 16:37:43 +0000 (UTC) Received: from [10.251.9.101] (rrcs-24-173-95-34.sw.biz.rr.com [24.173.95.34]) by iris.zentaur.org (Postfix) with ESMTPSA id 4NLWNR0nJQz3wZb for ; Mon, 28 Nov 2022 16:37:43 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------aC58BJNM085riFVtr0RU2bqZ" Message-ID: Date: Mon, 28 Nov 2022 10:37:42 -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: further discussion of zsh/random (was [PATCH] zsh/random module [UPDATED]) Content-Language: en-US To: zsh-workers@zsh.org References: <6275a5ac-3a47-f591-7b3c-380ec4fed5ac@zentaur.org> <20221118162325.7i3qzqljyx4a7z3h@chazelas.org> <20221118181253.cdejvepmnsmia7jm@chazelas.org> <20221123195222.GO27622@tarpaulin.shahaf.local2> <20221124161958.jh3xlzq7hiyw6vut@chazelas.org> <7235d036-0a4e-4957-0e09-ae074181008f@zentaur.org> <20221125085311.qbia75bcmqwylt54@chazelas.org> <20221125094018.7ssecb3fppzusnmi@chazelas.org> From: Clinton Bunch In-Reply-To: <20221125094018.7ssecb3fppzusnmi@chazelas.org> X-Seq: 51081 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: This is a multi-part message in MIME format. --------------aC58BJNM085riFVtr0RU2bqZ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Having read all the criticism of the API, I still don't agree with the=20 minimalist view nor do I favor implementing a mathfunc to mirror a=20 semi-obscure API, and prefer to keep SRANDOM in a module that fails to=20 load if no kernel random source is available=C2=A0 so I'm proposing a new= API. builtin: zrandint -c /count/=3D*1 *-U /upper/=3D*MAX_UINT32 *-L /lower/=3D*0 *-s=20 /scalar /-a /array /-f raw|hex|*dec* **default output is equivalent to _echo $SRANDOM_. I can special case=20 the nonsensical arguments like /count/=3D0 and /upper/=3D/lower /if that'= s=20 the wish of the group/. upper/ is inclusive zrandbyte -c /count/=3D*8 *-s /scalar /-a /array /-f raw|hex|*hex:*|dec: =C2=A0=C2=A0=C2=A0 default output format will be a colon-separated strin= g of bytes=20 encoded in hex, in an array hex and hex: are equivalent.=C2=A0 I could,=20 instead, add another option to specify a separator and default to :. Parameter: SRANDOM =C2=A0=C2=A0=C2=A0 A random, uniformly-distributed, unsigned, 32-bit int= eger. mathfunc: zrandomf() =C2=A0=C2=A0=C2=A0 produces a random float-point number from 0 to 1=C2=A0= inclusive zrandomi(/upper/=3D*MAX_UINT32*,/lower/=3D*0*,/inclusive/=3D*0*) =C2=A0=C2=A0=C2=A0 takes 0 to 3 arguments.=C2=A0 exclusive by default to= accommodate=20 ${string[zrandomi($#string)+1]} I'm not particularly tied to any of the names except SRANDOM --------------aC58BJNM085riFVtr0RU2bqZ Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Having read all the criticism of the API, I still don't agree with the minimalist view nor do I favor implementing a mathfunc to mirror a semi-obscure API, and prefer to keep SRANDOM in a module that fails to load if no kernel random source is available=C2=A0 so= I'm proposing a new API.

builtin:

zrandint -c count=3D1 -U upper=3DMAX_UINT32 -L lower=3D0 -s scalar -a array -= f raw|hex|dec

=C2=A0=C2=A0=C2=A0 default output = is equivalent to echo $SRANDOM. I can special case the nonsensical arguments like count=3D0 and upper=3Dlower i= f that's the wish of the group. upper is inclusive

zrandbyte -c count=3D8 -s <= i>scalar -a array -f raw|hex|hex:|dec:

=C2=A0=C2=A0=C2=A0 default output format = will be a colon-separated string of bytes encoded in hex, in an array hex and hex: are equivalent.=C2=A0 I could, instead, add another opti= on to specify a separator and default to :.

Parameter:

SRANDOM

=C2=A0=C2=A0=C2=A0 A random, uniformly-di= stributed, unsigned, 32-bit integer.

mathfunc:

zrandomf()

=C2=A0=C2=A0=C2=A0 produces a random floa= t-point number from 0 to 1=C2=A0 inclusive

zrandomi(upper=3DMAX_UINT32= ,lower=3D0,inclusive=3D0)

=C2=A0=C2=A0=C2=A0 takes 0 to 3 arguments= .=C2=A0 exclusive by default to accommodate ${string[zrandomi($#string)+1]}

I'm not particularly tied to any of th= e names except SRANDOM



--------------aC58BJNM085riFVtr0RU2bqZ--