From a1c94e30d70f83787bf3d7b17f78422e4a8dd32d Mon Sep 17 00:00:00 2001 From: stgabi Date: Sun, 7 Oct 2018 14:12:21 -0300 Subject: [PATCH] add Random numbers in R --- .Rhistory | 0 Algorithms/Algorithms/Random Number/random.R | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .Rhistory create mode 100644 Algorithms/Algorithms/Random Number/random.R diff --git a/.Rhistory b/.Rhistory new file mode 100644 index 0000000..e69de29 diff --git a/Algorithms/Algorithms/Random Number/random.R b/Algorithms/Algorithms/Random Number/random.R new file mode 100644 index 0000000..54fe850 --- /dev/null +++ b/Algorithms/Algorithms/Random Number/random.R @@ -0,0 +1,17 @@ +## 500 random numbers with normal distribution +rnorm(500) + +#Random number with normal distribution using mean and standard deviation +rnorm(500,mean=10,sd=1); + +# 500 random numbers between 0 and 100 +runif(500, min=0, max=100); + +#Random sample of 3 numbers in the range of 0 to 100 with replacement +sample(1:100, 3, replace=TRUE) + +#visualize numbers distribution in a histogram +hist(rnorm(500)); + +#density +plot(density(runif(500, min=0, max=100))); \ No newline at end of file