FreeBASIC's PRNG #2

General FreeBASIC programming questions.
Post Reply
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

says i need MSVCP120, and my system drive is full. haha..
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Post by paul doe »

dafhi wrote:says i need MSVCP120, and my system drive is full. haha..
Dafhi, that's just a run-time (a .dll). I doubt that you don't have space to install at least one more of those =D

Here:
https://www.dllme.com/dll/files/msvcp120_dll.html
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC's PRNG #2

Post by dodicat »

Do what I would do.
Ebay
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

you know what's weird. i plopped the dll from the link to the pipe folder. still got the message

went to put it in system32 and it said there's already 1 in there!

but literally I have 512K free on C:

my projects folder is D: drive and i have 300G left. I have a less full windows image if i ever need to restore. I've honestly been running with c being this full for at least 2 weeks. I have had no problems up till now
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC's PRNG #2

Post by deltarho[1859] »

I have an internal drive F:

I created a folder F:\PR64 and dropped RNG_test.exe into it.

I now drop all my pipefile programs into that folder: 10 so far.

With paul doe's approach, which dafhi is using, I just execute the pipefile program.

I don't find Paul's last code very readable compared to mine. They are effectively the same.

Here I use Paul's 'Open pipe cmd ..." but with my 'Do/Loop.

Code: Select all

Dim Shared As Ulongint x = 12, w = 0
Dim As String cmd = "RNG_test stdin32 -multithreaded"
Dim As Long fileHandle = Freefile()
Dim Shared S As String * 1048576
Dim As Ulong Ptr SPtr, BasePtr
Dim As Long j

Function msws() As Ulong
  x *= x
  w += &H5851F42D4C957F2D ' 64-bit prime as used by PCG32II
  x += w
  x = ( x Shr 32 ) Or ( x Shl 32 )
  Return( x )
End Function

SPtr = Cptr(Ulong Ptr, Strptr( S ))
BasePtr = SPtr

Open pipe cmd For Binary Access Write As fileHandle
Do
  For j = 1 To 262144
    *SPtr = msws ' Your 32-bit generator here
    SPtr += 1
  Next
  Print #fileHandle, S;
  SPtr = BasePtr
Loop
Close( fileHandle )
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

20 seconds, blank console. my cpu isn't weak by most standards
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC's PRNG #2

Post by dodicat »

I ran mine from
PractRand_0.94\PractRand_094\bin\msvc12_64bit

I didn't detatch rng_test.exe from it's location.
Who knows, it maybe does a call from there.
I didn't look closely at the c++ source code.
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

still nothing
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC's PRNG #2

Post by deltarho[1859] »

@dafhi

A pound to a penny you are not following our instructions to the letter.

I remember an email exchange I had with a friend a few years back. After about 10 exchanges I asked him to write down exactly what he was doing and let me know.

There were about 7 steps to my instructions. He missed one out. "Oh, I didn't see that.", he wrote. <laugh>
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

don't know what to tell ya. i'm using PractRand 0.94

I need "chdir exepath" on a lot of my .bas files to get bitmaps and other things to load.

I am .. EXCEPTIONAL man!
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Post by paul doe »

dafhi wrote:I need "chdir exepath" on a lot of my .bas files to get bitmaps and other things to load.
Wait. Which IDE are you using?
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Re: FreeBASIC's PRNG #2

Post by dafhi »

paul doe wrote:Wait. Which IDE are you using?
wxFBE viewtopic.php?f=8&t=20284&hilit=wxFBE#p177990
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC's PRNG #2

Post by deltarho[1859] »

@dafhi

Create a folder somewhere called, say, PR64.

Now drop RNG_test.exe into that folder.

Now compile the following as MT.exe and drop that into PR64.

Execute MT.exe - I got to 8GBs and pulled out.

MT.exe is testing FB's generator #3.

Code: Select all

Dim As String cmd = "RNG_test stdin32 -multithreaded"
Dim As Long fileHandle = Freefile()
Dim Shared S As String * 1048576
Dim As Ulong Ptr SPtr, BasePtr
Dim As Long i
 
Randomize , 3
SPtr = Cptr(Ulong Ptr, Strptr( S ))
BasePtr = SPtr
Open pipe cmd For Binary Access Write As fileHandle
Do
  For i = 1 To 262144
    *SPtr = Rnd*2^32
    SPtr += 1
  Next
  Print #fileHandle, S;
  SPtr = BasePtr
Loop
Close( fileHandle )
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Post by paul doe »

dafhi wrote:
paul doe wrote:Wait. Which IDE are you using?
wxFBE viewtopic.php?f=8&t=20284&hilit=wxFBE#p177990
I see. I'm using FBEdit, and it creates the temporary exe (the one that gets compiled when you use 'QuickRun') in the folder where it is saved. So:
  • Save the file you want to test in the folder where RNG_test.exe is located.
  • Add 'chdir exepath' to the code.
  • And now QuickRun it. You shouldn't have any more troubles.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Post by paul doe »

This is the path returned by exePath() if a QuickRun is issued when I didn't saved the file yet:

Code: Select all

C:\Programming\FbEdit
And, this is the path returned by exePath() when I save the file on the proper folder:

Code: Select all

C:\Programming\C++\PractRand_0.94\PractRand_094\bin\msvc12_64bit
Post Reply