www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/24/16:00:27

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help: Using the clock to seed srand()
Date: Thu, 24 Apr 1997 09:43:44 -0700
Organization: Alcyone Systems
Lines: 21
Message-ID: <335F8DC0.451497FD@alcyone.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970424144239 DOT 11402W-100000 AT is>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:

> You are using real-mode tricks in a protected-mode program, which is
> why your program crashes.  You can't access absolute addresses in that
> way, because protected mode doesn't allow that.

Besides, there's an easier way to seed the random number generator using
the time, and it's ANSI C:

    #include <stdlib.h>
    #include <time.h>

    srand(time(0));

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
                      "The future / is right there."
                                 / Bill Moyers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019