Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87069 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23533 invoked from network); 8 Jul 2015 09:59:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jul 2015 09:59:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@paragonie.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=scott@paragonie.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain paragonie.com from 209.85.192.47 cause and error) X-PHP-List-Original-Sender: scott@paragonie.com X-Host-Fingerprint: 209.85.192.47 mail-qg0-f47.google.com Received: from [209.85.192.47] ([209.85.192.47:36153] helo=mail-qg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/63-16503-C64FC955 for ; Wed, 08 Jul 2015 05:59:10 -0400 Received: by qgeg89 with SMTP id g89so97094361qge.3 for ; Wed, 08 Jul 2015 02:59:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=JYw2dFegPhkp+D5mYe/1zW51WcwwgWUnNC9QriBkiaA=; b=IxjUzb/KaVvs6vxkKJ+tILxotCU/C/ExI08yqmVvwn7AinezGDUxdzH/+pk+AJohoo YQIsCqcZHY6J+PGDRTxh5jPuPhEXw5Y8Vm5WiBJcy603XQUNjzxdgtexPj1s2ZItiiZK RMNDppf+uE1A+GsN11EIzXZbpkjcEz0Xr+KqTEBpO5Z+Dwdqb3ugoLeTeN9cRsg5VEIW IO+rTin7DnGbVGWjl1qht4FkTSi4otNQY4R/OkjWLjtVA59kTa5BZHTawuVL40ElIRuI JiqYgjF1e4hMDgk3zSaInBJZWnh/8MB7LbNGw+8d0hOSO8JM7uaSLAeQvjzW9tOlwF+q /tLQ== X-Gm-Message-State: ALoCoQmFK3vb5DVN+o+gbLjWIHuYPDmCqqlmRUC1v9ZodR3VoM9Fs4I6kFntfcOSB/QFHkkbytge MIME-Version: 1.0 X-Received: by 10.55.15.145 with SMTP id 17mr10930404qkp.95.1436349545581; Wed, 08 Jul 2015 02:59:05 -0700 (PDT) Received: by 10.96.83.102 with HTTP; Wed, 8 Jul 2015 02:59:05 -0700 (PDT) X-Originating-IP: [71.47.14.165] Date: Wed, 8 Jul 2015 05:59:05 -0400 Message-ID: To: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: random_compat From: scott@paragonie.com (Scott Arciszewski) Hi everyone, I'm working on a library to backport random_bytes() and random_int() into PHP 5. The effort is located on Github if anyone is interested: https://github.com/paragonie/random_compat My reason for this email is that I'm running into one compatibility issue that I don't think I can safely work around: If we let random_int() default to -PHP_INT_MAX and PHP_INT_MAX, then the difference between the two (used to calculate the range) will overflow into a float, which will lead to a loss of precision. My current compromise is to use -(PHP_INT_MAX/2) and PHP_INT_MAX/2, but I'm not sure if there's a better solution. Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises