In MATLAB, you can use the randi
function to generate a matrix of random integers of a specified size. To create a random number generator of size 23 by 34, you can use the following code:
main.m163 chars3 lines
The rng('default')
function is optional, but it sets the random number generator's seed to the default value, which ensures that the random numbers generated are always the same. If you omit this line, you will get different random numbers each time you run the script.
gistlibby LogSnag