Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115324 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68264 invoked from network); 6 Jul 2021 14:09:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jul 2021 14:09:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 79CA81804CC for ; Tue, 6 Jul 2021 07:31:02 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 6 Jul 2021 07:31:02 -0700 (PDT) Received: by mail-ed1-f49.google.com with SMTP id m17so6684715edc.9 for ; Tue, 06 Jul 2021 07:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=RtNcAb0nzrb7V7/5NA4enQ1h2cZHmCkloJySGe/YDDs=; b=sWbDIxhpBpqdMBYbJQuE9w+hle5zb8nyKm6LYlLyyD7wxmwAVsGjut+MPKE7zDnI1U svAkXkUH/urzanQ+jvpm2Loa1udyajaH2XkyuetdYYvwryA2RZlyLp84X7KbZPTVc/1h 0ljSo2UhOiz9U4g8VY2Pkak4BQX7ZzkF+j5rOOI94AE7PmKQTHnvgLlo7JEgR7x6bW/h 5yhc7zWPrR9QQtyPt9TQdTDLdnUxPAJuMTUiph3O2fjvxX11czZbfsWWYlg9M5rv7paP Ymf21Wf7Z9YC/y8MdPqzrdfaWoR5Gc26YPCWNf1aZ704xVlViWl0MSo8fGmbrNTwZmKh 8Ubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=RtNcAb0nzrb7V7/5NA4enQ1h2cZHmCkloJySGe/YDDs=; b=AJGCQ1eS2iZeIb6C5vSbVumfDlBvYwhmpLV3VtD93J8Gn0xA5lL6ytViOSU7or3iSx Dm4G58Mra6VCDbcmR7OGkRJgJ9iug8Q8/OemXY4mDftfPy4gJ8PRWY7HfQV8v8tMgSc2 rrJlIrr1bk0d+F6Nje+4lZB9PEWN+Tl8flLd++AmPno26D4aWIaqCjzhf4DtJ0HocbrR ROrA7AEa2xWxUkNewFgFLmxOf0vhraVe5VEXEv3VoRj52Ag8u1ZE5rgF48xwut70dSdp XKvHnsROjQaZJ0B2VKvaONYJWUN/OVQdHFjgSc9g/P1bXQxDrDAjoWnGyKyiSZ8h9Qgt omAg== X-Gm-Message-State: AOAM531cyaDjIumnKOwBjrvjKlrN88yOufulJKVUCmmqRkcqfsCulja3 9XPkbXtqhFTokyJJPedvTYpEvYFYTX0jUDd6XTYt0weSQcs= X-Google-Smtp-Source: ABdhPJzjf+TsQc8NXkHloNmmZPYus5Y+VIgJmp8Hw5NUHcofDGJiEQUjj+EAfBx8cYFhklOx9RUF0DWDyaibQhu6rck= X-Received: by 2002:aa7:dc02:: with SMTP id b2mr23090640edu.46.1625581860132; Tue, 06 Jul 2021 07:31:00 -0700 (PDT) MIME-Version: 1.0 References: <03e301d76f76$8e2f7d60$aa8e7820$@jhdxr.com> In-Reply-To: <03e301d76f76$8e2f7d60$aa8e7820$@jhdxr.com> Date: Tue, 6 Jul 2021 23:30:49 +0900 Message-ID: To: CHU Zhaowei , PHP internals Content-Type: multipart/alternative; boundary="0000000000005399a205c6754512" Subject: Re: [PHP-DEV] [RFC] Add Random Extension (before: Add Random class) From: zeriyoshi@gmail.com (Go Kudo) --0000000000005399a205c6754512 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I was late in noticing the email. I'm sorry. > I still feel we should find a better name for them. This is based on Java's Random.nextInt(), which may indeed be confusing. How about generateInt()? > What's the range of its return? It's not clear in the RFC. Currently, there is no way to check this, but we believe that since the RNG implementation is now class-based, there is no need to check this anymore. The size of the RNG to be generated is clear at the time of implementation, and implementing a way to check this would override the method and break consistency. Regards, Go Kudo 2021=E5=B9=B47=E6=9C=883=E6=97=A5(=E5=9C=9F) 4:15 CHU Zhaowei : > >> "Why does this method exist at all? When would you use it instead of > >> getInt()?" > >> > > The case for this would be if you want to get a raw unrounded random > number sequence as a number. The situations where this is required would > certainly be limited, but it would be nice to have. (At least, I know of > several production codes that use the result of mt_rand() with no > arguments.) > > These two methods confused me at first as well, but I think it's ok with > me after I check the documentation of mt_rand(), which also supports > calling without range. So, compatibility is one of the reasons why this > method exists, although I still feel we should find a better name for the= m. > They are too similar now, you won't be able to tell the difference withou= t > looking into the documentation or source code. > > Besides the name issue, I have another question for nextInt(). What's the > range of its return? It's not clear in the RFC. The range of mt_rand() > (without min and max) is 0 to mt_getrandmax(), so how about nextInt()? is > there any equivalent method/constant for it? > > Regards, > CHU Zhaowei > > > > --0000000000005399a205c6754512--