Search found 2047 matches

by deltarho[1859]
Nov 04, 2019 8:29
Forum: General
Topic: Performance problems with rnd function while multi-threading
Replies: 24
Views: 977

Re: Performance problems with rnd function while multi-threading

I don't have an axe to grind on this because I don't use Rnd.
by deltarho[1859]
Nov 04, 2019 1:40
Forum: Projects
Topic: WinFBE Editor and FreeBASIC Compiler (All-in-One Package) (Updated November 21, 2019)
Replies: 600
Views: 92937

Re: WinFBE Editor and FreeBASIC Compiler (All-in-One Package) (Updated November 2, 2019)

cbruce's keywords is 3.85KB, mine is 28.2KB and includes many Windows APIs, no duplications. I don't use the default keyword colour, my eyes see blue very close to black so I use Lavender, Bold. http://deltarho.org.uk/Downloads/keywords.jpg #define #else #elseif #endmacro #error #if #ifdef #ifndef #...
by deltarho[1859]
Nov 03, 2019 23:36
Forum: General
Topic: Performance problems with rnd function while multi-threading
Replies: 24
Views: 977

Re: Performance problems with rnd function while multi-threading

Being slow doesn't make it unsafe. I did another test with a small code edit. In the primary thread I included this For i = 1 To counter y = Rnd If y = copy then duplicate += 1 copy = y Next and printed 'duplicate' at the end of the code. With Twin as false I didn't get any duplication. With Twin a...
by deltarho[1859]
Nov 03, 2019 22:53
Forum: General
Topic: Performance problems with rnd function while multi-threading
Replies: 24
Views: 977

Re: Performance problems with rnd function while multi-threading

The following code illustrates that RND, out of the box, is not thread safe. With '#define Twin False' I get 87 MHz which is what I would expect of Mersenne Twister on my machine. With '#define Twin True' I get '16 MHz 16 MHz'. This is indicative of massive collisions. That 16 MHz varies, sometimes ...
by deltarho[1859]
Nov 03, 2019 14:52
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

Found the paper, the graph is on page 12: Further scramblings of Marsaglia’s xorshift generators

It was published in the 'Journal of Computational and Applied Mathematics', May 2017 so it is not that old.

The heavy bias was toward zeros and not as I wrote earlier - memory fog.
by deltarho[1859]
Nov 03, 2019 14:35
Forum: General
Topic: Home-brewed encryption
Replies: 42
Views: 1044

Re: Home-brewed encryption

Image
by deltarho[1859]
Nov 03, 2019 14:18
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

Most generators have a heavy bias in the bits of their early generated random numbers ie too many ones or too many zeros. It doesn't take long for the bias to vanish. Sebastian Vigna published a graph of quite a few generators showing when the bias vanished; some vanished very rapidly and some took ...
by deltarho[1859]
Nov 03, 2019 13:41
Forum: General
Topic: Home-brewed encryption
Replies: 42
Views: 1044

Re: Home-brewed encryption

Is that supposed to solve the problem in my last post?
by deltarho[1859]
Nov 03, 2019 13:23
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

I do not understand the Overload functionality. If I specify pcg.range(1,123) will it then invoke the Long version? Yes. If either or both parameters is a float then the float range will be used. #Include "PCG32II.bas" Dim As pcg32 pcg Print pcg.Range(1,500);" ";pcg.Range(1.,500...
by deltarho[1859]
Nov 03, 2019 11:24
Forum: General
Topic: Performance problems with rnd function while multi-threading
Replies: 24
Views: 977

Re: Performance problems with rnd function while multi-threading

Any generator can be made thread safe, but they will need a major rewrite. However, why bother because none of the FB's generators are particularly fast compared with the generators developed in the last few years. I knocked out an assembler version of the Mersenne Twister which pushed the throughpu...
by deltarho[1859]
Nov 03, 2019 11:14
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

Probably a noob question Declare Function range Overload( Byval One As Long, Byval Two As Long ) As Long Declare Function range Overload ( Byval One As double, Byval Two As Double ) as Double in the 'Type pcg32' declaration. How about 30. :) You are joking, right? I would like to see an Intel Core ...
by deltarho[1859]
Nov 03, 2019 10:55
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

You keep posting whilst I am composing my posts. http://deltarho.org.uk/Downloads/smile.png Anyway, PCG32II's reputation has been restored and seems to be coming up trumps in your code. But is that okay to do? Yep The amazing thing is that with four generators working your PC is actually generating ...
by deltarho[1859]
Nov 03, 2019 10:32
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

OK, I have spotted your problem. Dim shared pcg as pcg32 All your threads are sharing the same generator so you will get collisions. For four threads you need Dim shared as pcg32 pcgA, pcgB, pcgC, pcgD. pcgA should be given to the primary thread and the others to the other threads. Not quite sure ho...
by deltarho[1859]
Nov 03, 2019 10:04
Forum: General
Topic: Performance problems with rnd function while multi-threading
Replies: 24
Views: 977

Re: Performance problems with rnd function while multi-threading

Why does rnd slow down so much when called from many threads? Because the many threads are calling the same function, ie RND, and there will be collisions causing a drop in throughput. The generator has to be thread safe to avoid collisions and very few generators are thread safe, none of the FreeB...
by deltarho[1859]
Nov 03, 2019 9:51
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 1436

Re: PCG32II Help file

I have not read your code yet but have run it.

One thread:
FreeBASIC 4.86
PCG32II 0.61
Custom 5.47

Four threads:
FreeBASIC 6.23
PCG32II 0.23
Custom 1.59

This seems to contradict your results.

I will now read your code.

Go to advanced search