[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 


Random Number Generators have been studied extensively during the computer age and a large body of documentation exists. Delphi's Random function is limited to 32 bits, about 4 billion.    When I had a need for random integers up to 300 billion recently, I thought that finding a 64 bit Delphi or Pascal version would be simple.   There are plenty of C-whatever examples, but not so many on our side of the fence. 

I ended up installing two versions into our MathsLib unit.

For Delphi versions after D7, I used the Random64 function by J.R Stockton found at http://www.merlyn.demon.co.uk/programs/mathutys.pas.  It uses the unsigned 64 bit integer type UInt64, and so cannot be used in D7 and earlier versions.  For those compilers I wrote a Random64 function which converts a passed Int64 integer to  a TInteger big integer type and pass that to the Random procedure in our UBigIntsV4 unit.  The returned value is converted back to an Int64 type and returned to the caller.

I plan to do more statistical testing of these functions and perhaps locate or develop a function that will work for both early and later Delphi versions.  Windows has a native "CryptGenRandom" function if I find the appropriate API to allow Delphi to use it. 

The current routines are located    

 

Links to Explore

  http://www.freepascal.org/docs-html/rtl/system/random.html             
  http://www.tek-tips.com/faqs.cfm?fid=7590
  http://www.merlyn.demon.co.uk/programs/mathutys.pas
  http://www.delphitools.info/2011/12/13/pimp-your-random-numbers-with-xorshift/
 

 Running/Exploring the Program 

bulletDownload DFF Library Source  (Current version DFFLibV15 )

 

Created August 13, 2013

Modified January 17, 2018

 

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.