Solved

Randomize

Posted on 1998-10-24
4
312 Views
Last Modified: 2010-04-06
I have many files pas in my program.
And almost each files using random function.
Where I should put Randomize function.
Just in main file or each files pas that using random function.

Regards,
Joely
0
Comment
Question by:joely
  • 2
4 Comments
 
LVL 17

Expert Comment

by:inthe
Comment Utility
Hello Joely

Do you mean the program form or it's main unit(unit1)
because i doubt it would work only in the main unit(unit1)
If you only put it in the main file does it work ???

¤¤¤¤¤¤¤ InThe ¤¤¤¤¤¤¤
0
 
LVL 10

Accepted Solution

by:
viktornet earned 10 total points
Comment Utility
You need to put it in each function that you need to use Random() as in...

procedure Whatever;
var
  i : Integer;
begin
  Randomize;
  i := Random(200);
end;

btw- Barry, I'm still curious and don't know how to make those stars... Did you have time to send the floopies???

Cheers,
Viktor
0
 

Author Comment

by:joely
Comment Utility
Hello Viktor

I should put it every time I'm using Random function. Why ?
Why don't I just put it once, for example in formcreate or formshow.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Because the Randomize function simply randomizes the seed of the real random number..thus if you want to have a completely different number in somewhere youshould do that... Possibly in each of the functions where you use Random()...

Cheers,
Viktor
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now