From owner-freebsd-stable@FreeBSD.ORG Thu Sep 21 14:59:43 2006 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3385B16A407; Thu, 21 Sep 2006 14:59:43 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E657B43D49; Thu, 21 Sep 2006 14:59:38 +0000 (GMT) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id D971434BA1; Thu, 21 Sep 2006 17:59:36 +0300 (EEST) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18680-08; Thu, 21 Sep 2006 17:59:33 +0300 (EEST) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id 9BD1034B9D; Thu, 21 Sep 2006 17:59:33 +0300 (EEST) Message-ID: <4512A8CB.7050502@bulinfo.net> Date: Thu, 21 Sep 2006 17:59:23 +0300 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: Robert Watson References: <4512942A.1020400@bulinfo.net> <20060921151848.E37863@fledge.watson.org> In-Reply-To: <20060921151848.E37863@fledge.watson.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: stable@freebsd.org Subject: Re: Unable to generate random numbers? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Sep 2006 14:59:43 -0000 Hmm, I missed to call srandomdev() before random(). Thanks for response Robert Watson wrote: > > On Thu, 21 Sep 2006, Krassimir Slavchev wrote: > >> When I try to generate random bytes using rand() or random() >> functions I found that these functions return constant values!? > > Sounds pretty odd -- even if not explicitly seeded, you should be > getting something pseudo-random, even if what you get is > deterministic. Are you calling srandomdev() before invoking > random()? Are you definitely using the result of invoking random() > and not using the function pointer for random(), which will be constant? > > Robert N M Watson > Computer Laboratory > University of Cambridge > >> >> I am running: >> FreeBSD krassi 6.1-STABLE FreeBSD 6.1-STABLE #13: Tue Jul 11 13:41:31 >> EEST 2006 root@krassi:/usr/obj/usr/src/sys/MyKernel i386 >> >> sysctl kern.random >> kern.random.yarrow.gengateinterval: 10 >> kern.random.yarrow.bins: 10 >> kern.random.yarrow.fastthresh: 192 >> kern.random.yarrow.slowthresh: 256 >> kern.random.yarrow.slowoverthresh: 2 >> kern.random.sys.seeded: 1 >> kern.random.sys.harvest.ethernet: 1 >> kern.random.sys.harvest.point_to_point: 1 >> kern.random.sys.harvest.interrupt: 1 >> kern.random.sys.harvest.swi: 0 >> >> >> Best Regards >> >> _______________________________________________ >> freebsd-stable@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-stable >> To unsubscribe, send any mail to >> "freebsd-stable-unsubscribe@freebsd.org" >> > -- Krassimir Slavchev Bulinfo Ltd. krassi@bulinfo.net (+359 2) 969-9160 http://www.bulinfo.net (+359 2) 969-9166