File Download
Links for fulltext
(May Require Subscription)
- Publisher Website: 10.1145/358407.358414
- Scopus: eid_2-s2.0-0040519931
- WOS: WOS:000166623100003
- Find via
Supplementary
- Citations:
- Appears in Collections:
Article: A simple method for generating gamma variables
Title | A simple method for generating gamma variables |
---|---|
Authors | |
Keywords | Algorithms Gamma distribution Performance Random number generation Ziggurat method |
Issue Date | 2000 |
Publisher | Association for Computing Machinery, Inc. |
Citation | Acm Transactions On Mathematical Software, 2000, v. 26 n. 3, p. 363-372 How to Cite? |
Abstract | We offer a procedure for generating a gamma variate as the cube of a suitably scaled normal variate. It is fast and simple, assuming one has a fast way to generate normal variables. In brief: generate a normal variate x and a uniform variate U until In(U) < 0.5x2 + d - dv + dln(u), then return dv. Here, the gamma parameter is α ≥ 1, and v = (1 + x/√9d)3, with d = α - 1/3. The efficiency is high, exceeding 0.951, 0.981, 0.992, 0.996 at α = 1, 2, 4, 8. The procedure can be made to run faster by means of a simple squeeze that avoids the two logarithms most of the time: return dv if U < 1 - 0.0331x4. We give a short C program for any α ≥ 1, and show how to boost an α < 1 into an α > 1. The gamma procedure is particularly fast for C implementation if the normal variate is generated in-line, via the #define feature. We include such an inline version, based on our ziggurat method. With it, and an inline uniform generator, gamma variates can be produced in 400MHz CPUs at better than 1.3 million per second, with the parameter a changing from call to call. Categories and Subject Descriptors: G.4 [Mathematics of Computing]: Mathematical Software; 1.6 [Computing Methodologies]: Simulation and Modeling. |
Persistent Identifier | http://hdl.handle.net/10722/89056 |
ISSN | 2023 Impact Factor: 2.7 2023 SCImago Journal Rankings: 1.040 |
ISI Accession Number ID | |
References |
DC Field | Value | Language |
---|---|---|
dc.contributor.author | Marsaglia, G | en_HK |
dc.contributor.author | Tsang, WW | en_HK |
dc.date.accessioned | 2010-09-06T09:51:50Z | - |
dc.date.available | 2010-09-06T09:51:50Z | - |
dc.date.issued | 2000 | en_HK |
dc.identifier.citation | Acm Transactions On Mathematical Software, 2000, v. 26 n. 3, p. 363-372 | en_HK |
dc.identifier.issn | 0098-3500 | en_HK |
dc.identifier.uri | http://hdl.handle.net/10722/89056 | - |
dc.description.abstract | We offer a procedure for generating a gamma variate as the cube of a suitably scaled normal variate. It is fast and simple, assuming one has a fast way to generate normal variables. In brief: generate a normal variate x and a uniform variate U until In(U) < 0.5x2 + d - dv + dln(u), then return dv. Here, the gamma parameter is α ≥ 1, and v = (1 + x/√9d)3, with d = α - 1/3. The efficiency is high, exceeding 0.951, 0.981, 0.992, 0.996 at α = 1, 2, 4, 8. The procedure can be made to run faster by means of a simple squeeze that avoids the two logarithms most of the time: return dv if U < 1 - 0.0331x4. We give a short C program for any α ≥ 1, and show how to boost an α < 1 into an α > 1. The gamma procedure is particularly fast for C implementation if the normal variate is generated in-line, via the #define feature. We include such an inline version, based on our ziggurat method. With it, and an inline uniform generator, gamma variates can be produced in 400MHz CPUs at better than 1.3 million per second, with the parameter a changing from call to call. Categories and Subject Descriptors: G.4 [Mathematics of Computing]: Mathematical Software; 1.6 [Computing Methodologies]: Simulation and Modeling. | en_HK |
dc.language | eng | en_HK |
dc.publisher | Association for Computing Machinery, Inc. | en_HK |
dc.relation.ispartof | ACM Transactions on Mathematical Software | en_HK |
dc.rights | ACM Transactions on Mathematical Software. Copyright © Association for Computing Machinery, Inc. | en_HK |
dc.subject | Algorithms | en_HK |
dc.subject | Gamma distribution | en_HK |
dc.subject | Performance | en_HK |
dc.subject | Random number generation | en_HK |
dc.subject | Ziggurat method | en_HK |
dc.title | A simple method for generating gamma variables | en_HK |
dc.type | Article | en_HK |
dc.identifier.openurl | http://library.hku.hk:4550/resserv?sid=HKU:IR&issn=0730-0301&volume=26&spage=363&epage=372&date=2000&atitle=A+simple+method+for+generating+gamma+variables | en_HK |
dc.identifier.email | Tsang, WW:tsang@cs.hku.hk | en_HK |
dc.identifier.authority | Tsang, WW=rp00179 | en_HK |
dc.description.nature | link_to_OA_fulltext | - |
dc.identifier.doi | 10.1145/358407.358414 | - |
dc.identifier.scopus | eid_2-s2.0-0040519931 | en_HK |
dc.identifier.hkuros | 67143 | en_HK |
dc.relation.references | http://www.scopus.com/mlt/select.url?eid=2-s2.0-0040519931&selection=ref&src=s&origin=recordpage | en_HK |
dc.identifier.volume | 26 | en_HK |
dc.identifier.issue | 3 | en_HK |
dc.identifier.spage | 363 | en_HK |
dc.identifier.epage | 372 | en_HK |
dc.identifier.isi | WOS:000166623100003 | - |
dc.publisher.place | United States | en_HK |
dc.identifier.scopusauthorid | Marsaglia, G=6603739473 | en_HK |
dc.identifier.scopusauthorid | Tsang, WW=7201558521 | en_HK |
dc.identifier.issnl | 0098-3500 | - |