www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/25/12:15:54

From: "Florian Janoschek" <FJanoschek AT donau DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Random numbers aren't random - ???
Date: Fri, 25 Sep 1998 16:56:26 +0200
Lines: 24
NNTP-Posting-Host: 195.189.160.132
Message-ID: <360bc15f.0@news.zeitung-online.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello,

I'm just writing a little encryption program which sould be able to create
its own random passwords. The code is something like that:

srandom(biostime(0, 0)); // DOS-ticks are used as seed value
unsigned char C = (rand() %  255) + 1; // no null-characters

I can't find any errors in this 2 lines, but the program returns everytime
the same password.

Perhaps I should use a different source for my seed value, but why and what?

BTW: As I checked, biostime() works quiet well, the bug must be somewhere
else...

Thanks.

--
Best regards,
Florian Janoschek
http://blubisoftware.notrix.de


- Raw text -


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