[R] Drawing random numbers from Uniform distribution with infinite range

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Mon Jul 28 18:10:40 CEST 2025


That makes no sense, mathematically. If a measure has constant density over an infinite region, then the total mass is infinite, i.e. not a probability measure.

-pd 

> On 28 Jul 2025, at 18.00, Daniel Lobo <danielobo9976 using gmail.com> wrote:
> 
> Hi,
> 
> I want to draw a set of random number from Uniform distribution where
> Support is the entire Real line.
> 
> runif(4, min = -Inf, max = Inf)
> 
> However it produces all NAN
> 
> Could you please help with the right approach?
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business SchoolSolbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list