Uniform random number generator (RNG)

Click For Summary

Discussion Overview

The discussion revolves around the search for a fast and long-period random number generator (RNG) suitable for use in Fortran programming. Participants explore various RNG options, including those from "Numerical Recipes" and other sources, while debating the trade-offs between speed and quality.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses dissatisfaction with the speed of the ran1 RNG from "Numerical Recipes" and seeks alternatives that are faster and have a long period of at least 10^12.
  • Another participant suggests the Mersenne Twister as a potential RNG option.
  • A different participant questions whether the original poster has considered using the RNG that is part of the Fortran language itself.
  • George Marsaglia's development of several pseudorandom number generators (PRNGs) is mentioned, noting that some produce integers while others produce floating-point values directly.
  • One participant critiques ran1, stating it is fast but has a short period, and challenges the notion that one can have both speed and quality in RNGs.

Areas of Agreement / Disagreement

Participants express differing opinions on the performance and quality of various RNGs, indicating that there is no consensus on the best option. The discussion remains unresolved regarding which RNG is optimal for the stated requirements.

Contextual Notes

Participants have not fully explored the assumptions behind their claims about speed and quality, nor have they provided detailed comparisons of the RNGs mentioned. The discussion lacks specific performance metrics for the RNGs discussed.

Carter2x
Messages
3
Reaction score
0
I am writing a program in Fortran language, in which i use a Random Number Generator (RNG) subroutine.
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
While searching on the internet for a faster RNG i found a few Fortran subroutines
(many were in other languages C/C++ ...), but they were slower than the one i had.
Do you know were can i find a fast and quite longperiod (>= 10^12) RNG ?
 
Technology news on Phys.org
Carter2x said:
I am writing a program in Fortran language, in which i use a Random Number Generator (RNG) subroutine.
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
While searching on the internet for a faster RNG i found a few Fortran subroutines
(many were in other languages C/C++ ...), but they were slower than the one i had.
Do you know were can i find a fast and quite longperiod (>= 10^12) RNG ?

Have you tried using the one that's part of the language?

George Marsaglia developed a number of PRNGs.
Some produce integers directly, others produce floating-point values directly.
 
Carter2x said:
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
ran1 is fast, but it is lousy (it has way too short a period). What makes you think it is slow?

You can have fast or you can have good. Asking for both at once is a bit much.
 

Similar threads

Replies
22
Views
5K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
7
Views
5K
Replies
19
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
9K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K