Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118023 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36728 invoked from network); 20 Jun 2022 15:11:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Jun 2022 15:11:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5EFCB180555 for ; Mon, 20 Jun 2022 10:00:06 -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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 20 Jun 2022 10:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1655744404; bh=TBxIDSCR61oaz/sH4Od8AwbX3c45dr/6OhOlE+jmqEE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=FZogqQHH1fxOkDxdM9Q0N94PC/nflLnJ2ntWk03ylgQPaO89mj7bpnPkhpIlp+yIJ MxBGPeU+T6YBJADpeHcLFElUgOzq3Vi30eW0x7q/aGIzto4dnu6sW2O+IxeZmKMOef SM9lrCv1FnJhWCTqW6AzI+V6xE6Izp6YVFquSljSEfWYqy5rVhae8clEE+wY/OFOai FqkrxLwqqc3NI3RP7zZ9Vom15JWElHVCQJCWHcDnhEzF1mnDd7w4fjAvKQlYX4eKGF SSiiDISSTfeL5ZZhqEF4JCtYhHaBQFM2wmC3AtQtRKTQzJpvk2EqHI5zfH8pJ+RvD0 CMuTcpG7Hg77Q== Message-ID: <5533d807-949b-0759-b13e-fec9b44d7ef7@bastelstu.be> Date: Mon, 20 Jun 2022 19:00:02 +0200 MIME-Version: 1.0 Content-Language: en-US To: Go Kudo , Marc , internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension Improvement From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 6/20/22 07:20, Go Kudo wrote: > What about a signature like `Randomizer::pickArrayKeys(array $array, int > $num): array`? > The previous behavior when `int $num` is 1 can be easily reproduced as > follows: > > ```php > $randomizer = new Random\Randomizer(new Random\Engine\Mt19937(1234, > MT_RAND_PHP)); > [$key] = $randomizer->pickArrayKeys(['foo', 'bar', 'baz'], 1); > ```php I like that one. >> If multiple keys are returned, they will be returned in the order they > were present in the original array. > > Perhaps there is no particular significance to this specification. I don't > think it is necessary, but considering the drop-in replacement from > array_rand(), I think it is desirable to leave it as is. I agree. Best regards Tim Düsterhus