Generalized Ziggurat Algorithm for Unimodal and Unbounded Probability Density Functions with Zest

10/10/2018
by   Morteza Jalalvand, et al.
0

We present a modified Ziggurat algorithm that could generate a random number from all unimodal and unbounded PDFs. For PDFs that have unbounded density and/or unbounded support we use a combination of nonlinear mapping function and rejection sampling to generate a random number from the peak and/or the tail distribution. A family of mapping functions and their corresponding acceptance probability functions are presented (along with the criteria for their use and their efficiency) that could be used to generate random numbers from infinite tails and unbounded densities. The Zest library which is a C++ implementation of this algorithm is also presented. Zest can efficiently generate normal, exponential, cauchy, gamma, Weibull, log-normal, chi-squared, student's t and Fisher's f variates. The user can also define their custom PDF as a class and supply it as a template argument to our library's class without modifying any part of the library. Performance of Zest is compared against performance of random modules of (GCC's implementation of) Standard Template Library (STL) and Boost. The presented results show that Zest is faster than both in most cases, sometimes by a factor of more than 10. We also present a C++ implementation of a uniform floating-point random number generator (RNG) which is capable of producing all representable floating-point numbers in [0,1) which will be used in the Ziggurat algorithm near unbounded peaks and tails. The common method of dividing a random integer by the range of the RNG can not produce random floating-point numbers with fully random fraction bits and very small random numbers. The presented uniform floating-point RNG is very efficient and in the case of producing double precision floating-point numbers it's even faster than simply multiplying a 64-bit integer by 2^-64.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/10/2021

Finding normal binary floating-point factors in constant time

Solving the floating-point equation x ⊗ y = z, where x, y and z belong t...
research
04/20/2019

An Improved Algorithm for hypot(a,b)

We develop a fast and accurate algorithm for evaluating √(a^2+b^2) for t...
research
01/11/2021

Number Parsing at a Gigabyte per Second

With disks and networks providing gigabytes per second, parsing decimal ...
research
01/25/2020

SLEEF: A Portable Vectorized Library of C Standard Mathematical Functions

In this paper, we present techniques used to implement our portable vect...
research
03/18/2020

Random number generators produce collisions: Why, how many and more

It seems surprising that when applying widely used random number generat...
research
08/20/2017

Conversion of Mersenne Twister to double-precision floating-point numbers

The 32-bit Mersenne Twister generator MT19937 is a widely used random nu...
research
11/27/2018

Class of scalable parallel and vectorizable pseudorandom number generators based on non-cryptographic RSA exponentiation ciphers

Parallel supercomputer-based Monte Carlo and stochastic simulatons requi...

Please sign up or login with your details

Forgot password? Click here to reset