SHARE
TWEET

Lottó

a guest Oct 12th, 2010 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type tintarr=array of integer;
  2.  
  3. function bennevan(const mi:integer; const miben:tintarr):boolean;
  4. var i:integer;
  5. begin
  6.   result:=false;
  7.   for i:=0 to length(miben)-1 do if mi=miben[i] then begin
  8.     result:=true;
  9.     break;
  10.   end;
  11. end;
  12.  
  13. function lotto(const max,db:integer):tintarr;
  14. var rnd:integer;
  15. begin
  16.   setlength(result,0);
  17.   randomize;
  18.   while length(result)<db do begin
  19.     rnd:=random(max);
  20.     if not bennevan(rnd,result) then begin
  21.       setlength(result,length(result)+1);
  22.       result[length(result)-1]:=rnd;
  23.     end;
  24.   end;
  25. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top