Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,082 questions

55,955 answers

573 users

How to generate random floating point numbers in Pascal

1 Answer

0 votes
program RandomNumbersProgram;

const
  N = 10;
  Lower = 0.0;
  Upper = 3.0;

type
  TDoubleArray = array[1..N] of Real;

function GenerateRandomNumbers: TDoubleArray;
var
  i: Integer;
begin
  Randomize;
  for i := 1 to N do
    GenerateRandomNumbers[i] := Random * (Upper - Lower) + Lower;
end;

var
  RandomNumbers: TDoubleArray;
  i: Integer;
begin
  RandomNumbers := GenerateRandomNumbers;
  
  for i := 1 to N do
    Write(RandomNumbers[i]:0:6, ' ');
end.



(*
run:

1.162551 1.212829 1.194064 2.688364 0.827583 0.359914 2.741655 1.527474 0.642609 2.512924 

*)

 



answered Nov 2, 2025 by avibootz
...