Hello Fred!
I would like to write a small tool in purebasic using the mathlib commands random(), randomseed() and save all the datas like following into an ini file:
; File
rand = 12 ; Random value
seed = 612 ; RandomSeed value
...
Later i would like to read the inifiles with the values for random and randomseed (c based) and import into my C++/C# projects! Could you share us a working asm/c/c++/c# version of your purebasic random and randomseed (100% compatible) commands? So everybody could use this commands in purebasic and c/c++/c# and having everytime the same results! This is my problem! I dont know on which way you managed it! Many thanks in advance!
i'm pretty sure the answer you will get will be "no"
quite simply, the user agreement for PB says you cannot use pb to simply wrap commands for use with other languages. and that sounds pretty much exactly what you're asking for in this case...
aszid wrote:i'm pretty sure the answer you will get will be "no"
quite simply, the user agreement for PB says you cannot use pb to simply wrap commands for use with other languages. and that sounds pretty much exactly what you're asking for in this case...
i could be wrong though i suppose...
good luck
Aeehmm, i will still wait for Freds answer! I dont want wrap the full math lib or any other purebasic related stuff. Still only want to know how to write a Random and RandomSeed command that gives 100% same results in pb/asm/c/c++/c#... I think this should be no problem to share this routine to write tools in purebasic and produce the same results from the datafiles in any other language. I still think fred would be so friendly and help..!?
It was a similar thread about this random routine and the best for you if you want crossplatform random is to rewrite your own (not difficult, lot of example on the web) as the PB one can change without any notices for speed/size reason so it will break the compatibility.
There's a publicly available random number generator called the 'Mersenne Twister'. It's probably one of the best random number generators available, if not the best.
Thanks to Andy Amaya. Can someone post a purebasic and a c# version of the random and randomseed algo?
Fred: your random and randomseed dont produces same results when using the commands on win/linux/amiga??? I only need it for win32 system and maybe any day for linux!? I would like to use a c# converted version of the purebasic commands due fact pure is fast and i dont know how to implent a c/c++ routine (random/randomseed) to pure nor having any knowledge about assembler :roll:
someone so nice here to post a random() and randomseed() function for purebasic (inline asm?) and a version for c/c++/c# (inline asm?), having same result on both languages?
Just go there and type "random" the the search box
There is a nice example written in ASM.
cool! 10x paul! now i have a working asm random function in asm but can someone show me how to use this asm code as function inside c++/c#!? have never tried to mix asm and any c related stuff. Thanks for more input