Hi EVerybody,
I would like to generate a random number from chi-square distribution. But I can not find any class that is able to do that.
Thanks in advance
Printable View
Hi EVerybody,
I would like to generate a random number from chi-square distribution. But I can not find any class that is able to do that.
Thanks in advance
This isn't exactly a Swing question (this is the Swing forum). Have you had a look at Google first? What have you found there? Likely you'll need to download the chi-square data tables from some source. SourceForge may have some useful public domain code for this, but again, likely you best bet will be Google. Best of luck.
I think apache have code for that in org.apache.commons.math
It's been like a million years since I've had anything to do with chi-square. Here are some ideas...
Create a table (like Fubarable commented) or generate the values in the program and (either way) stuff the values in an array. Then randomly generate array indexes and get/pull the elements/values at those indexes.
Luck,
CJSL