Related Articles
Compute Randomly Drawn Cauchy Density in R Programming – rcauchy() Function
• Last Updated : 25 Jun, 2020

rcauchy() function in R Language is used to compute random cauchy density among a range of inputs.

Syntax: rcauchy(N, scale)

Parameters:
N: Sample Size
scale: Scale to plot graph

Example 1:

 # R program to generate # random cauchy density points  # Setting seed for# random number generationset.seed(1000)  # Set sample sizeN <- 20  # Calling rcauchy() Functiony <- rcauchy(N, scale = 10)y

Output:

[1]   16.654755   -9.459054    3.740548  -14.639724 -193.891140    2.160767
[7]  -10.735449  -37.226131    8.051377   10.392275   19.616577   -9.662595
[13]   15.442965   -4.484467   -9.147612    2.330620  431.105051  -22.117519
[19]    2.730892  -37.046773

Example 2:

 # R program to generate # random cauchy density points  # Setting seed for# random number generationset.seed(1000)  # Set sample sizeN <- 500  # Calling rcauchy() Functiony <- rcauchy(N, scale = 10)  # Plotting graphplot(y)

Output:

My Personal Notes arrow_drop_up