Made a procedure for deriving the matrix, filled with a random number generator, but it displays three matrices and always A = B = C or A = B and not equal C, or A not equal B = C. (I don’t change the code) What is the problem?

Program Lab5_1; type miniarr = array[1..20,1..20] of integer; var A,B,C,M: miniarr; n: integer; procedure array_output (k:integer;D: miniarr); var i,j:byte; begin randomize; for i := 1 to k do begin for j:=1 to k do begin D[i,j]:= random(10); write(D[i,j]:5); end; writeln; end; end; begin repeat begin write('Введите целое число N,которое больше 0,чтоб определить матрицы A, B, C(NxN): '); read(n); end; until n>0; writeln ('Вывод массива A: '); array_output(n,A); writeln ('Вывод массива B: '); array_output(n,B); writeln ('Вывод массива C: '); array_output(n,C); end. 

Water output screens: enter image description here

enter image description here

    1 answer 1

    Randomize too quickly.

     procedure array_output (k:integer;D: miniarr); var i, j: byte; begin //randomize; ... end; randomize; array_output(n,A); array_output(n,B); array_output(n,C); 

    Have you forgotten anything here?

    Problem with C # increment

    • And what should I do? I recently on this portal and do not really understand. - ANGRY SHARK knyaz2000
    • @ ANGRYSHARKknyaz2000 To the left of the answer there is a tick, which is available only to the author of the question. A suitable answer should be noted with this sign as accepted. - Igor
    • Thank. And another question on this topic. Why if I remove randomize at all, does the program still work? - ANGRY SHARK knyaz2000
    • @ ANGRYSHARKknyaz2000 It works, but it works the same every time. And with randomize; - each time in different ways. - Igor