The main research in this paper is Java programming to implement sampling or sampling of beta distribution, as follows.
This article will use the toolkit provided by math3 to sample beta distributions. The following program samples the beta distribution function of alpha=81 and beta=219, and a total of 10,000 samples are sampled.
package function;/** * @author: Qian Yang, School of Management, Hefei University of Technology* @email:[email protected] * @ The main use of gamma-related function in math3*/import org.apache.commons.math3.distribution.BetaDistribution;import org.apache.commons.math3.special.Gamma;public class dergamma { public static void main(String[] args) { //Sample 1000 times for (int i = 0; i < 10000; i++) { System.out.println(betasampler(81,219)); } } //beta distribution sampling public static double betasampler(double alpha,double beta){ BetaDistribution beta=new BetaDistribution(alpha,beta); return beta.sample(); }}
The output part of the results after sampling is:
Summarize
The above is the entire content of this article about Java programming to implement sampling or sampling instance code for beta distribution. I hope it will be helpful to everyone. Interested friends can continue to refer to other related topics on this site. If there are any shortcomings, please leave a message to point it out. Thank you friends for your support for this site!