Showing posts with label random number generator. Show all posts
Showing posts with label random number generator. Show all posts

Wednesday, March 02, 2016

a Random Number Generator

Rand Number Generator

Tuesday, August 28, 2012

Random number generators


There are many random generators that can be used for random sampling  such as rand() in SAS, dbms_random.rand() in Oracle, rand() in Excel spreadsheet. I have helped implement a Winchmann- Hill random generator using PL/SQL. Here is a link to WH algorithm (http://www2.imperial.ac.uk/~hohs/S9/2007-2008/wichmannhill.pdf).

The reason to implement Winchmann-Hill random generator using PL/SQL was that we wanted to replicate the sequence of random numbers precisely given the same random seed. We did not want to use SAS or Oracle random functions because we do not know how the details of their algorithms. We want to build WH random generators that work consistently across platforms, i.e., SAS and Oracle database. This is easier said than done. One of the lessons we learnt was that SAS integer can only have 17 digits while Oracle integer support 38 digits. We have to make sure that the random seed is not too large.

Tuesday, May 29, 2012

Why Bother to Calculate Mod(x, 30269)?

I was trying to implement Wichmann-Hill random number generator in Oracle. The calculation of mod(x, 30269) is part of the algorithm. The algorithm is described in Algorithm AS 183: An Efficient and Portable Pseudo-Random Number Generator.