Skip to content

Instantly share code, notes, and snippets.

View maptracker's full-sized avatar

Charles Tilford maptracker

  • Work-related, non-proprietary coding
View GitHub Profile
@maptracker
maptracker / randomMatrix.R
Last active November 6, 2015 18:22
#R code for a #random #matrix
randomMatrix <- function( rows = 1000, cols = NULL, min = 1, max = 100) {
# Originally from my Coursera assignment: https://github.com/maptracker/ProgrammingAssignment2/blob/master/cachematrix.R
# Returns a rows x cols matrix of random numbers
# If columns are not defined, then set them to number of rows:
if (is.null(cols)) cols <- rows
# Generate random integers to put into the matrix
random <- runif( cols * rows, min = min, max = max + 1)