Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about optimizing code

Author: Angrim

Date: 19:20:32 07/07/03

Go up one level in this thread


On July 07, 2003 at 17:40:46, Russell Reagan wrote:


>    srand(0);
>    start = clock();
>    for (i = 0, n = 0; i < MAX_ITERATIONS; i++) {
>        unsigned long bits = rand() & 0xff;

I would expect that the cost of all those calls to rand()
is more than the cost of the rest of the loop.
rand() is not cheap.

Angrim



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.