From owner-freebsd-questions Tue Feb 16 18:41: 8 1999 Delivered-To: freebsd-questions@freebsd.org Received: from hyperhost.net (ether.lightrealm.com [207.159.132.5]) by hub.freebsd.org (Postfix) with ESMTP id E86A41142D for ; Tue, 16 Feb 1999 18:36:56 -0800 (PST) (envelope-from patseal@hyperhost.net) Received: from port1.annex8.radix.net (port1.annex8.radix.net [205.252.108.1]) by hyperhost.net (8.8.5/8.8.5) with ESMTP id VAA24806 for ; Tue, 16 Feb 1999 21:36:46 -0500 (EST) Date: Tue, 16 Feb 1999 21:36:40 -0500 (EST) From: Patrick Seal To: freebsd-questions@FreeBSD.ORG Subject: Random Numbers Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In this the best way to get a number from one to ten in C: #include randn(float value) { value = random() * value / 2147483648.0; return(value); } n = randn(10.0) + 1 printf("%i", n); I realize it's platform dependent. Is there a better way? ------------------------------------ _____________________________________ Patrick Seal |"Microsoft isn't evil, they just make | really crappy operating systems." Hyperhost - http://www.hyperhost.net| -Linus Torvalds hosting and Design http://www.freebsd.org - http://www.linux.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message