vba - How to convert this code from vb6 to delphi -


private sub acak ( ) dim random new random ( ) dim a, c, m, i, y byte dim x( ) byte = {0,1,2,3,4,5,6,7,8,9,10} = 5 c = 7 m = 8 x (0) = random.next (1, 16) = 1 16        x(i) = (a*x(i-1)+c) mod m        if x(i) = 0            y =        end if  next  button1.text = x(16)  acakbutton () 

end sub

please me because can't use vb , can't convert because i'm still newbie

it this:

interface  uses  ...;  type   tmyform = class(tform)     button1: tbutton;     ...    private     procedure acak;    ...    end;  ...  implementation  uses   math;  procedure tmyform.acak; var   a, c, m, i, y: byte;   x: array[0..16] of byte; begin   randomize;   := 0 10     x[i] := i;   := 5;   c := 7;   m := 8;   x[0] := randomrange(1, 16);   := 1 16   begin     x[i] := (a*x[i-1]+c) mod m;     if x[i] = 0       y := i;   end;   button1.text := inttostr(x[16]);   acakbutton; end; 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -