rmaxwell() depends on rgamma(), so what you actually need is to download R source (rgamma() might depend further on other functions, though).
> library(VGAM) > rmaxwell function (n, a) { if (!is.Numeric(n, posit = TRUE, allow = 1)) stop("bad input for argument 'n'") if (any(a <= 0)) stop("argument 'a' must be positive") sqrt(2 * rgamma(n = n, 1.5)/a) } <environment: namespace:VGAM> Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA On Fri, Mar 12, 2010 at 12:18 AM, 王杰彪 <try...@163.com> wrote: > Hi R useRs: > > How can I generate a random sample from Maxwell Distribution in C language? > Since I know the function rmaxwell {VGAM}, I tried the function r2c {r2c}. > But I still cannot find the source code. > > Thanks for your kind help. > > RegaRds, > > 2010-03-12 > > > > Randel > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.