Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118828 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16764 invoked from network); 16 Oct 2022 20:24:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Oct 2022 20:24:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D8A8B1804A7 for ; Sun, 16 Oct 2022 13:24:50 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 16 Oct 2022 13:24:50 -0700 (PDT) Received: by mail-ua1-f42.google.com with SMTP id y20so3683972uao.8 for ; Sun, 16 Oct 2022 13:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bpu5IkZJ4iAaB7TOmFMpsvAMgcST+IQU/5H3h3Jjk5Y=; b=eON+LAhwnGj/ZgibBT+9KDkgYtY+OGxMznUlJLy9pGfWf/VsmR+L/eu79QN4h+Gbd7 PSBmzpF1cwCUhePteP7M4rVkRmCiSXyoUa9VAqDeSc3vmUjNRN2CEPq+UbpMe2+GAKbV yk5bWj33HHw/jvuWcIjtk5QjA4tIfbgvZ0nmvSTBd0HPIlWbZGlfwWKNSyooH/PSl4yf Q1pTvBcyAQLZsl23joJb8QuHypzwFuDVdMpVKdrwJwR/7j95fnxYwXi1LXZSrhQBKfEp jbPtUTnwdGYKy9NJRkBtRhIyN1eqBh+uDsKTYfI4VFUg3+XA+X/moFeL2TuIwukqCh8z yneQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bpu5IkZJ4iAaB7TOmFMpsvAMgcST+IQU/5H3h3Jjk5Y=; b=UchVAb/62CbN4GtEtZ1pZdLmuWPWpaXimL4vfifJa5YVl1JlSkgqA6YkpiIeNVKWu6 EhoYp5drAtS+erbYThgxbpL8BBT11PkchaFVCi5gDb3qwfQsXQiElimJ4PsUmdUddIpS XREAL9VQMXxGOhVnKK3Aun16fci1GUzgYpLWwXQxKLizZPGDH8vEZpQLMMCRI/0xubBM 7aRkV6WwAGBoiiwgrx5ZJQztP3gZEYz4AwEbotilAcUrtyoD+9ifUIlVpiqK0B/X/SYs smebRAPNmbrDhMH1n0sQlYVbvzTMDHxdd1WeK5qC2d+ppCHjZ67yibaVzoNddRxgUrhD n/KA== X-Gm-Message-State: ACrzQf1f4hueWVgJhIQpKXPOK2QVqoyk4sjuLmM7LAN6XO0+BqIxHwia 8cZgSP18gVB7XiIq7XyJ0zbH/jM/coBKvLT0tW0TOQ== X-Google-Smtp-Source: AMsMyM4emrvTCs1iEAYoA29x5QOjM0ofCkcMJenB7RsfJxd80XQkVcaukYg8ZQkTLGRYqt5K0FlplnqWdAIV0P8AGMA= X-Received: by 2002:a9f:350c:0:b0:3e4:1518:7e8b with SMTP id o12-20020a9f350c000000b003e415187e8bmr3088678uao.34.1665951889316; Sun, 16 Oct 2022 13:24:49 -0700 (PDT) MIME-Version: 1.0 References: <5ceebae4-a3fb-5d29-cdb7-dceed7b07c78@wcflabs.de> In-Reply-To: <5ceebae4-a3fb-5d29-cdb7-dceed7b07c78@wcflabs.de> Date: Sun, 16 Oct 2022 22:24:38 +0200 Message-ID: To: =?UTF-8?Q?Joshua_R=C3=BCsweg?= Cc: internals@lists.php.net, tim@bastelstu.be Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC [Discussion]: Randomizer Additions From: Danack@basereality.com (Dan Ackroyd) Hello Joshua, > Shall an option be added to getFloat() that changes the logic to select from [$min, $max] (i.e. allowing the maximum to be returned)? And how should that look like? Boolean parameter? Enum? An enum would probably be nice, and possibly be for all four cases of min_(inclusive|exclusive)_max_(inclusive|exclusive) unless there is a technical reason to not include all of them. > Generating a random string containing specific characters...thus requires= multiple lines of code for what effectively is a very simple operation. Yeah, though those lines of code add distinction and emphasis for is meant by character. In particular, users might be surprised when they give this string "abc=F0=9F=98=8B=F0=9F=91=A8=E2=80=8D=F0=9F=91=A9=E2=80=8D=F0=9F=91=A6"* an= d get a non-ascii result. You're going to need to be really precise on the naming and I'm not at all sure there is a single version that would be useful enough to belong in core. > whereas a 64 Bit engine could generate randomness for 8 characters at onc= e. I'm really not sure that many programs are going to be speed limited by random number generation. For those that are, writing their own generator to consume all 64 bits of randomness for each call sounds reasonably sensible, unless a useful general api can be thought of. For the float side of the RFC, as there are technical limitations on which platforms it would be usable on, there needs to be a way of determining whether the nextFloat and getFloat methods are going to work. The way this is done on Imagick is to put appropriate defines in the stub file and in the C code implementations so that the methods aren't available on the class for the platforms where it isn't going to function correctly. I made a PR for that to Tim's repo, though I don't know of an environment where it can be tested. cheers Dan Ack * For those who get a mangled version, the "characters" there are 'a' 'b' 'c' 'smily-face' 'man + zerowidth joiner + woman + zerowidth joiner + child'. The last is a character that takes a mere 18 bytes to represent.