From owner-svn-src-all@freebsd.org Sat May 21 22:40:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE9AEB45287 for ; Sat, 21 May 2016 22:40:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm8-vm0.bullet.mail.bf1.yahoo.com (nm8-vm0.bullet.mail.bf1.yahoo.com [98.139.213.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FEF81D99 for ; Sat, 21 May 2016 22:40:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1463870404; bh=5p5BWpprTF4sEinNBCFuO3gC83StiUtZPS0CLc0zsMU=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=PNEfgdgdbmskfyVgmuBpaJZhk4M0d6NiG3KmuuzESt3bGE+oONIYU/ezoA33wM1XIYJV+gU2nSVz/fvMtSMZXLeu7TYXdC91GDML4XbNYD4hFVc/cDi/L+aGbnDYB6voGscrGUdW8kg+XGk9DdSch0LcCmxyRvqwWM/uAnIpYHlwsWR4r8HYpaKh0/f0ffz+N8w6K22eDyo8T0PsWptqZVsNAY8HPl46/kKmHc+MF8FG/gQIF82K4/df8c/HxEtLGK7s2OyIS6U4znfdEPpO6e2CWD5mc43KrPPKVXwIZeA8Yne97yJU9qB//683L7+dFY5iRZOZm2ct9NZxWUpGJw== Received: from [98.139.215.140] by nm8.bullet.mail.bf1.yahoo.com with NNFMP; 21 May 2016 22:40:04 -0000 Received: from [98.139.211.202] by tm11.bullet.mail.bf1.yahoo.com with NNFMP; 21 May 2016 22:40:04 -0000 Received: from [127.0.0.1] by smtp211.mail.bf1.yahoo.com with NNFMP; 21 May 2016 22:40:04 -0000 X-Yahoo-Newman-Id: 167905.46780.bm@smtp211.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Zn.kJx0VM1npAMSKZcmBMfUXtpujI7krXMvnEwYseUtz0h5 KJTeCro79RfYFRAO9WnObPrPspumKRTQ6oPuaMfI8INrYzZbbTW91S9rwAhg AqlDCxOxuXB9jGvHzCJAwyx5d7FzIHx5MW_GLOT6S.71GHDTT65iLQo8sfLj sJ3DcMzXl_aDv3.R6Im5FivMPGcNUhrSy.CHADZvW40KWIMmF6_Z8Xzk__Rr pKLZuWn2hXMEsR1qqu5A8jUbXR8Q8dG_Zq3F0I7uunPSgC98N90qDBRT9Nl7 bG_PlzNbC5V1VY6G2RNjfHNTjcKF4N06y8WmKDUmcLCklBKPM9hBUya6fJte IR1u_P29DZR.9.6sWt6tGpVusC6VLdvJw6WTmHnm.K04ySUppm595j1XIWEO 11t.zCNSN3hBODkVXuyVBp53JW2ZiNjiAsGtidmc4mHGDsBnuSFlwaDwAaC3 EZJEiUsn84Dqmva5NExqB2DdZm.EdNTKWXnNfh_tEM4.cC2PAVd1t3oNXA2e 0vtowynyWj0QLxsVBB_LPK1dzA.HWZf9V X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r300377 - head/sys/compat/ndis To: cem@FreeBSD.org References: <201605211752.u4LHqiHQ031457@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <262938a6-50bd-b6f4-24c9-895b837a368e@FreeBSD.org> Date: Sat, 21 May 2016 17:40:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2016 22:40:12 -0000 On 05/21/16 16:55, Conrad Meyer wrote: > On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni wrote: >> >> >> On 05/21/16 14:05, Conrad Meyer wrote: >>> Won't this still return a negative integer in many cases? >>> >>> random(9) returns u_long, whereas this rand() routine returns 'int'. >>> >>> Even on architectures where long is the same size as ordinary >>> integers, the range of possible results of the 'random() / 2 + 1' >>> expression, before implicit cast to signed, is [1, 2^31] (inclusive). >> >> >> According to: >> sys/libkern/random.c >> >> The result is uniform on [0, 2^31 - 1]. > > Ah, I missed that. Sorry! In that case, I'm not sure why this is > needed — the result fits in a non-negative 2's complement signed > integer. > Actually, I had missed it too. And I also had no idea we were working around the zero singularity. I will revert the change and will do an adjustment for the case where we use 0 as a seed (which in MS should be equivalent to 1). Pedro.