// Delphi
// selects 6 random numbers 1-49
LotteryNumbers.jpg
Code:
// author: Moralterror
// date: 16/03/05
// selects 6 random numbers between 1-49
var num: array of integer;
var i: integer;
begin
setLength(num,6);
num[0] := random(49)+1;
label1.caption := '';
label2.caption := '';
label3.caption := '';
label4.caption := '';
label5.caption := '';
label6.caption := '';
label1.caption := IntToStr(num[0]);
repeat
num[1] := random(49)+1;
if num[1] <> num[0] then
begin
label2.caption := IntToStr(num[1]);
end;
until label2.caption > '';
repeat
num[2] := random(49)+1;
if num[1] <> num[2] then
begin
if num[2] <> num[0] then
begin
label3.caption := IntToStr(num[2]);
end;
end;
until label3.caption > '';
repeat
num[3] := random(49)+1;
if num[1] <> num[3] then
begin
if num[3] <> num[0] then
begin
if num[3] <> num[2] then
begin
label4.caption := IntToStr(num[3]);
end;
end;
end;
until label4.caption > '';
repeat
num[4] := random(49)+1;
if num[1] <> num[4] then
begin
if num[4] <> num[0] then
begin
if num[4] <> num[2] then
begin
if num[4] <> num[3] then
begin
label5.caption := IntToStr(num[4]);
end;
end;
end;
end;
until label5.caption > '';
repeat
num[5] := random(49)+1;
if num[1] <> num[5] then
begin
if num[5] <> num[0] then
begin
if num[5] <> num[2] then
begin
if num[5] <> num[3] then
begin
if num[5] <> num[4] then
begin
label6.caption := IntToStr(num[5]);
end;
end;
end;
end;
end;
until label6.caption > '';
end;
That's just the button code