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


Groups > comp.programming.threads > #4689

About my Good random number generators and scalability..

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Horizon68 <horizon@horizon.com>
Newsgroups comp.programming.threads
Subject About my Good random number generators and scalability..
Date Sat, 27 Oct 2018 10:43:43 -0700
Organization A noiseless patient Spider
Lines 77
Message-ID <pr284f$g9c$7@dont-email.me> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 27 Oct 2018 17:43:43 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="3c52aa3a2ae254e58259a3dc946a131b"; logging-data="16684"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rU4kIYcwYkNHqL9Lz1iZMnPleyC4TrzM="
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1
Cancel-Lock sha1:vrGgtpFTqLuWHkIjCzI1EKL8g1E=
Content-Language en-US
X-Mozilla-News-Host news://news.eternal-september.org:119
Xref csiph.com comp.programming.threads:4689

Show key headers only | View raw


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.

Back to comp.programming.threads | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web