How to assign random integers to a matrix

Hi, and welcome!

Your code snippet is all that's required in this case. For anything data dependent or more complicated, however, please use a reproducible example, called a reprex.

One way to generate random integers is

(my_randoms <- sample(1:10, 8, replace=T))
#> [1] 4 5 9 6 1 9 1 2

Created on 2020-01-06 by the reprex package (v0.3.0)