In short, it ensures reproducible (pseudo) random number generation. I.e. so when you repeat my code, you will get the same numbers in the matrix. (For more, see here)
Then you do like this:
set.seed(245183)
m = matrix(data = sample(1:100), nrow = 10, ncol = 10)
print(m)
m[lower.tri(x = m, diag = FALSE)] = 0
print(m)
Yielding
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 18 57 15 96 11 10 82 72 9 12
[2,] 44 99 20 83 65 59 58 33 34 71
[3,] 37 26 94 19 55 23 98 68 95 22
[4,] 1 48 84 74 6 93 41 45 36 17
[5,] 50 67 66 85 56 90 51 78 91 63
[6,] 27 77 42 30 31 80 81 28 92 40
[7,] 79 4 73 16 29 100 39 13 43 35
[8,] 62 87 97 32 89 88 70 24 46 8
[9,] 69 76 25 54 14 49 47 21 38 53
[10,] 5 52 3 86 75 2 60 64 61 7
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 18 57 15 96 11 10 82 72 9 12
[2,] 0 99 20 83 65 59 58 33 34 71
[3,] 0 0 94 19 55 23 98 68 95 22
[4,] 0 0 0 74 6 93 41 45 36 17
[5,] 0 0 0 0 56 90 51 78 91 63
[6,] 0 0 0 0 0 80 81 28 92 40
[7,] 0 0 0 0 0 0 39 13 43 35
[8,] 0 0 0 0 0 0 0 24 46 8
[9,] 0 0 0 0 0 0 0 0 38 53
[10,] 0 0 0 0 0 0 0 0 0 7
Make sure you understand what the line m[lower.tri(x = m, diag = FALSE)] = 0 does, i.e. in the m-matrix, select all elements in the lower triangle excluding the diagonal and replace them with the value 0
Hope it helps 