www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/03/01:17:12

From: wilrod AT rocketmail DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: rand(), random() !!!!!!!!!!!!!!!!!!!!!!!??????
Date: Fri, 03 Jul 1998 04:55:56 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 22
Message-ID: <6nho8s$vi9$1@nnrp1.dejanews.com>
References: <1998070219214100 DOT PAA22119 AT ladder03 DOT news DOT aol DOT com>
NNTP-Posting-Host: 12.65.22.251
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <1998070219214100 DOT PAA22119 AT ladder03 DOT news DOT aol DOT com>,
  malcolmj7 AT aol DOT com (MalcolmJ7) wrote:
>
> how do i randomize these functions?
> every time i use them they give me the same numbers, in the same order.
> when I use srandom() this, still gives me same numbers, in the same order.
>
> isn't there a randomize() statement, like in turbo c?
>

Seed the random number generator:

#include <time.h>

srandom(time(NULL));

Voila!

WR

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

- Raw text -


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