R/plots.r

points = 100000
library(ggplot2)
duplot <- function(a, b)
{
  p = dugen(points, a, b)
  qplot(p, geom = "histogram", main = "Histogram for Uniform-ab Disturbution", xlab = "random number", binwidth = 0.01 * (b - a))
}

cuplot <- function()
{
  p = cugen(points)
  qplot(p, geom = "histogram", main = "Histogram for Uniform Disturbution", xlab = "random number", binwidth = 0.01)
}

brplot <- function(p)
{
  a = brgen(points, p)
  qplot(a, geom = "histogram", main = "Histogram for Bernoulli Disturbution", xlab = "random number", binwidth = 1)
}

biplot <- function(n, p)
{
  a = bigen(points, n, p)
  qplot(a, geom = "histogram", main = "Histogram for Binomial Disturbution", xlab = "random number", binwidth = 1)
}

geplot <- function(p)
{
  a = gegen(points, p)
  qplot(a, geom = "histogram", main = "Histogram for Geometric Disturbution", xlab = "random number", binwidth = 1)
}

expplot <- function(lambda)
{
  a = expgen(points, lambda)
  qplot(a, geom = "histogram", main = "Histogram for Exponential Disturbution", xlab = "random number", binwidth = 0.1 / lambda)
}

gaplot <- function(lambda, k)
{
  a = gagen(points, lambda, k)
  qplot(a, geom = "histogram", main = "Histogram for Gamma Disturbution", xlab = "random number", binwidth = 0.1 * sqrt(k) / lambda)
}

poplot <- function(lambda, t)
{
  a = pogen(points, lambda, t)
  qplot(a, geom = "histogram", main = "Histogram for Poisson Disturbution", xlab = "random number", binwidth = 1)
}

noplot <- function(u, s)
{
  a = nogen(points, u, s)
  qplot(a, geom = "histogram", main = "Histogram for Normal Disturbution", xlab = "random number", binwidth = 1)
}
mo-mahdavi/RandomGenerator documentation built on May 17, 2019, 4:33 p.m.