Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #4689 > unrolled thread

About my Good random number generators and scalability..

Started byHorizon68 <horizon@horizon.com>
First post2018-10-27 10:43 -0700
Last post2018-10-27 10:43 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.programming.threads


Contents

  About my Good random number generators and scalability.. Horizon68 <horizon@horizon.com> - 2018-10-27 10:43 -0700

#4689 — About my Good random number generators and scalability..

FromHorizon68 <horizon@horizon.com>
Date2018-10-27 10:43 -0700
SubjectAbout my Good random number generators and scalability..
Message-ID<pr284f$g9c$7@dont-email.me>
Hello..


About my Good random number generators and scalability..

I think my mersenne and splitmix64 random generators can work
with multiple threads and can be "scalable", look at at 
ThreadedRandomizedSeed() method to obtain a random seed:

==

function TMersenne.ThreadedRandomizedSeed():longword;
var a:double;
begin
if bool1=false
then
begin
bool1:=true;
a:=sin(GetCurrentThreadId)*high(longword);
if a < 0 then a:=-a;
if not assigned(mersenne1) then mersenne1:=TMersenne.create;
mersenne1.initialize(round(a));
result:=mersenne1.urand;
end
else result:=mersenne1.urand;

end;

==

You can create a mersenne or splitmix64 object for every
thread and initialize in each thread with ThreadedRandomizedSeed(), and 
after than get your random number in each thread, i think this way is 
"scalable".


My Good random number generators for Delphi and FreePascal
was updated to version 1.01, you can port them to C++..

Look at them they are powerful.

Author: Amine Moulay Ramdane that has enhanced
         both random number generators.

Description:

This is an enhanced versions of both Mersenne Twister that is a
good random number generator and Splitmix64 that is a fast random number 
generator, both have passed the BigCrush tests.

Look into defines.inc file, there is many options:

{$DEFINE CPU32} and {$DEFINE Windows32} for 32 bit systems

{$DEFINE CPU64} and {$DEFINE Windows64} for 64 bit systems

Look at test.pas demo inside the zip file...

You can download it from:

https://sites.google.com/site/scalable68/good-random-number-generators

Language: FPC Pascal v2.2.0+ / Delphi 5+: http://www.freepascal.org/

Operating Systems: Win , Linux and Mac (x86).

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

Required Delphi switches: -$O+



Thank you,
Amine Moulay Ramdane.

[toc] | [standalone]


Back to top | Article view | comp.programming.threads


csiph-web