Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8121243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:25:30+00:00 2026-06-06T05:25:30+00:00

From the documentation: Do not combine the call to Randomize in a loop with

  • 0

From the documentation:

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.

(Highlighting of ‘only once’ by me)

Best practices question:

if a Delphi library uses Random, should it only document the requirement of the initializing call of Randomize, and leave the call of Randomize to the user of the library?

Or should the library take care of the initialization, like

if System.RandSeed = 0 then Randomize;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:25:32+00:00Added an answer on June 6, 2026 at 5:25 am

    In my humble opinion it totally depends on the structure and purpose of your library.

    If the user will never see the Random calls, then I would suggest to make the library initialize it always. Putting it in the docs would not be necessary.

    On the other hand, if the user actually directly calls Random or some wrapper of it by using your library (which I guess is how your library works), then the user will (should) be aware that he is using some sort of random-generating function that will require an initialization, since the Random sequences in most languages are really pseudo-random sequences based on a seed.

    It might be that the user requires the random sequence to be initialized several times, or maybe he/she will be happy with initializing it just once. It totally depends on the user needs.

    I would not force it but rather make the Randomize call available to the user, and maybe give the user the possibility of telling the library to either take care of the initialization or leave it to him/her. And in this case all should be documented.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not clear from the documentation - when I indicate a cell width
From the documentation: If the platform supports the unsetenv() function, you can delete items
HttpServerUtility contains a public function called UrlEncode. It is not a shared function. HttpServerUtility
Description for Assert.Equals() from the MSDN Documentation: Do not use this method. That's it,
From the documentation it looks like this is not possible, but I want to
It's not clear for me from the documentation if a db4o server in java
NetBeans by default will not generate documentation from @author and @version tags. How do
Mozilla's documentation from elementFromPoint explains that the coordinates are not in physical pixels, but
From the documentation for SecondaryLoop , it is not clear when you should use
From the documentation under Platform section, It says It would run only if Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.