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
Post a Comment