🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #180

Re: Randomize and Random

#180
From: Jeremy Collins
Date: Mon, 26 Jan 2004 11:42
24 lines
1598 bytes
Eugene V. Goldberg wrote:

> I have the following functions:
> 
> function TfrmTickets.GetLogin(Prefix: String): String;
> var
>   i, Digit: Integer;
> begin
>   Result := Prefix;
>   Randomize;

Did you read the help for Randomize? The part where it says:

"Do not combine the call to Randomize in a loop with calls to the Random
function. Typically, Randomize is called only once, before all calls to
Random."

Call Randomize ONCE - when your application starts for example.


-- 
jc

Remove the -not from email
Technical Details
Message-ID: <4014fd2d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4014fbf5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,64bfe8b17e3a4cc8
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2004-01-26 03:47:21 PST
Date: Mon, 26 Jan 2004 11:42:38 +0000
From: Jeremy Collins <jd.collins@ntlworld-not.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.language.objectpascal
Subject: Re: Randomize and Random
References: <4014fbf5@newsgroups.borland.com>
In-Reply-To: <4014fbf5@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.101.19.29
Message-ID: <4014fd2d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075117357 81.101.19.29 (26 Jan 2004 03:42:37 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail