LG915
03-02-2013, 12:50 PM
:help Hello everyone, I have just spent quite a while to implement a sophisticated random number generator in C++ :banghead: , I now need to make a user friendly excel/VBA spreadsheet DSFMT128VBA that uses the .csv file created by the .exe. I've never practiced VBA, I really need your help. :help
1st step:
donwload this tar.gz/zip archive: http://www.mediafire.com/file/ycg936qfbc3c625/Merseene_Twiser_128_BIT_RNG.tar.gz
It contains 4 files:
MT128good.exe: The uniform random variable [0,1] generator that create a CSV called unif.csv
unif.csv:This excel . csv is created with different valeus each time the .exe is launched
msvr110d.dll: a dll you need to execute: MT128good.exe:
DSFMT128VBA.xslx; The EXCEL/VBA RNG spreadsheet that needs to be created with a button.
2nd step:
Create in DSFMT128VBA.xlsx a macro that exectutes the .exe MT128good.exe (I think ShellExecute has to be used) => a new .csv file still called unif.csv is generated with new random numbers.
3rd step
Implement the following macro to replace "." by "," in the csv.
Sub ReplaceText()
Dim c As Range
For Each c In ActiveSheet.UsedRange
c = Replace(c, "TextToFind", "TextToReplace")
Next
End Sub
Can you please tell me why I obtain the following error when implementing this sub routine on the csv: http://www.mediafire.com/view/?myfiles#5si0tk286m118sa
Do I have to add semi columns or commas at the end of each line in the raw c++ made .csv?
The CSV looks like:
0.989492209703375
0.184145098978442
0.365063754808973
0.253380136210709
0.512303430515757
0.279467114522703
0.558206434256604
0.302325086649532
0.292949402615390
0.110894333578039
0.771168133470690
0.703253925307222
0.421389240839892
0.472149722783674
0.176969965078023
0.706427742557473
4th step:
Make a macro that copy pasts the csv column in D8 IN DSFMT128VBA.xlsx AND refresh formula outputs.
Many thanks for your help! :help
1st step:
donwload this tar.gz/zip archive: http://www.mediafire.com/file/ycg936qfbc3c625/Merseene_Twiser_128_BIT_RNG.tar.gz
It contains 4 files:
MT128good.exe: The uniform random variable [0,1] generator that create a CSV called unif.csv
unif.csv:This excel . csv is created with different valeus each time the .exe is launched
msvr110d.dll: a dll you need to execute: MT128good.exe:
DSFMT128VBA.xslx; The EXCEL/VBA RNG spreadsheet that needs to be created with a button.
2nd step:
Create in DSFMT128VBA.xlsx a macro that exectutes the .exe MT128good.exe (I think ShellExecute has to be used) => a new .csv file still called unif.csv is generated with new random numbers.
3rd step
Implement the following macro to replace "." by "," in the csv.
Sub ReplaceText()
Dim c As Range
For Each c In ActiveSheet.UsedRange
c = Replace(c, "TextToFind", "TextToReplace")
Next
End Sub
Can you please tell me why I obtain the following error when implementing this sub routine on the csv: http://www.mediafire.com/view/?myfiles#5si0tk286m118sa
Do I have to add semi columns or commas at the end of each line in the raw c++ made .csv?
The CSV looks like:
0.989492209703375
0.184145098978442
0.365063754808973
0.253380136210709
0.512303430515757
0.279467114522703
0.558206434256604
0.302325086649532
0.292949402615390
0.110894333578039
0.771168133470690
0.703253925307222
0.421389240839892
0.472149722783674
0.176969965078023
0.706427742557473
4th step:
Make a macro that copy pasts the csv column in D8 IN DSFMT128VBA.xlsx AND refresh formula outputs.
Many thanks for your help! :help