Return-Path: william@bourbon.usc.edu Delivery-Date: Wed Nov 12 19:33:41 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id mAD3Xf29007373 for ; Wed, 12 Nov 2008 19:33:41 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAD3SwOs020698 for ; Wed, 12 Nov 2008 19:28:58 -0800 Message-Id: <200811130328.mAD3SwOs020698@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: cs551 regarding srand48() Date: Wed, 12 Nov 2008 19:28:58 -0800 From: Bill Cheng Someone wrote: > In order to implement a coin flip, you had suggested the use of drand48(). > The result of this depends on the seed that we give to srand48() which > ultimately decides whether to store the file or not. Is there a fixed seed > value that we have to give so that testing with the grading guidelines > remains consistent? Usually, you can just call time() and feed the return value to srand48(). If you want to make it a little more random, you can call gettimeofday() and add tv_sec and tv_usec together and feed the sum to srand48(). If you look at the grading guidelines, most tests use probability 0 or 1. -- Bill Cheng // bill.cheng@usc.edu