[erlang-questions] Fastest pseudo-random number-generator: erlang:statistics(io) ?

Kenji Rikitake kenji.rikitake@REDACTED
Thu Nov 26 07:14:30 CET 2009


Writing a linked-in driver with SFMT will give you much faster solution.
Or probably in NIF?

SIMD-oriented Fast Mersenne Twister (SFMT)
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
(C code available)

Kenji Rikitake

In the message <af660f57-3816-44fd-8f96-57676ecd6d36@REDACTED>
dated Tue, Nov 24, 2009 at 06:59:45AM -0800,
Thijs <thijsterlouw@REDACTED> writes:
> Today I needed a faster alternative for erlang:now(). It turns out
> that using erlang:now() is quite slow: it requires a system call. I
> decided to test some alternatives. My requirements are: speed, speed,
> speed :) I will use it in a server that is quite busy, so I figured I
> could use various system metrics to generate random numbers. I use
> these pseudo-random numbers to do load-balancing, log requests at
> random etc.

(rest snapped)


More information about the erlang-questions mailing list