Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About my Good random number generators and scalability..

16 views
Skip to first unread message

Horizon68

unread,
Oct 27, 2018, 1:43:06 PM10/27/18
to
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.

Chris M. Thomasson

unread,
Oct 27, 2018, 6:09:46 PM10/27/18
to
On 10/27/2018 10:42 AM, Horizon68 wrote:
> 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);

Partitioning wrt angle as thread id...

[...]
0 new messages