Originally Posted by potato
It still doesn't seem to be compiling right:
Code:
gcc -c -O3 -w -DLINUX -I../SDK/amx/ ../SDK/amx/*.c g++ -c -O3 -w -DLINUX -I../SDK/amx/ ../SDK/*.cpp g++ -c -O3 -w -DLINUX -I../SDK/amx/ *.cpp g++ -O2 -fshort-wchar -shared -o "./Release-Linux/merrandom.so" *.o collect2: ld terminated with signal 11 [Segmentation fault] merrandom.o: In function `Supports': merrandom.cpp:(.text+0x0): multiple definition of `Supports' helloworld.o:helloworld.cpp:(.text+0x0): first defined here merrandom.o: In function `Load': merrandom.cpp:(.text+0x10): multiple definition of `Load' helloworld.o:helloworld.cpp:(.text+0x10): first defined here merrandom.o:(.bss+0x0): multiple definition of `logprintf' helloworld.o:(.bss+0x0): first defined here /usr/lib/gcc/i486-pc-linux-gnu/4.2.4/../../../../i486-pc-linux-gnu/bin/ld: Warning: size of symbol `logprintf' changed from 8 in helloworld.o to 4 in merrandom.o merrandom.o: In function `Unload': merrandom.cpp:(.text+0x40): multiple definition of `Unload' helloworld.o:helloworld.cpp:(.text+0x50): first defined here merrandom.o: In function `AmxUnload': merrandom.cpp:(.text+0x60): multiple definition of `AmxUnload' helloworld.o:helloworld.cpp:(.text+0x70): first defined here merrandom.o: In function `AmxLoad': merrandom.cpp:(.text+0xd0): multiple definition of `AmxLoad' helloworld.o:helloworld.cpp:(.text+0x190): first defined here merrandom.o:(.bss+0x4): multiple definition of `ppPluginData' helloworld.o:(.bss+0x8): first defined here /usr/lib/gcc/i486-pc-linux-gnu/4.2.4/../../../../i486-pc-linux-gnu/bin/ld: Warning: size of symbol `ppPluginData' changed from 8 in helloworld.o to 4 in merrandom.o /usr/lib/gcc/i486-pc-linux-gnu/4.2.4/../../../../i486-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `helloworld.o' is incompatible with i386 output /usr/lib/gcc/i486-pc-linux-gnu/4.2.4/../../../../i486-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `invoke.o' is incompatible with i386 output make: *** [all] Error 1 |
Originally Posted by potato
When I deleted all object files then I was able to compile it.
Thanks! |
new
arry[10],
arry2[15],
arry3[2];
enum 10
{
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
}
enum 15
{
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
}
enum 2
{
0,
1
}
Originally Posted by DiDok
BUMP, found some bug/inconvinience: due to changed parameter you can't use MRandom(sizeof(array)) because it could return integer that doesn't fit in array (array[2], MRandom(sizeof(array)) returns 2, but array has only 0 and 1...). Remember to use sizeof()-1
|
Originally Posted by Щә яә Ґя
Where's the source ?
|
Originally Posted by Щә яә Ґя
Where's the source ?
|
[13:21:59] random -> Average time per call : 102 ns -> Total execution time : 51 ms -> Calls per second : 9803922 calls [13:21:59] random -> Average time per call : 102 ns -> Total execution time : 51 ms -> Calls per second : 9803922 calls [13:21:59] MRandom -> Average time per call : 100 ns -> Total execution time : 50 ms -> Calls per second : 10000000 calls [13:21:59] MRandom -> Average time per call : 96 ns -> Total execution time : 48 ms -> Calls per second : 10416667 calls [13:21:59] random -> Average time per call : 104 ns -> Total execution time : 52 ms -> Calls per second : 9615385 calls [13:21:59] random -> Average time per call : 102 ns -> Total execution time : 51 ms -> Calls per second : 9803922 calls [13:22:00] MRandom -> Average time per call : 98 ns -> Total execution time : 49 ms -> Calls per second : 10204082 calls [13:22:00] MRandom -> Average time per call : 96 ns -> Total execution time : 48 ms -> Calls per second : 10416667 calls [05:17:50] random -> Average time per call : 112 ns -> Total execution time : 56 ms -> Calls per second : 8928571 calls [05:17:50] random -> Average time per call : 122 ns -> Total execution time : 61 ms -> Calls per second : 8196721 calls [05:17:50] MRandom -> Average time per call : 100 ns -> Total execution time : 50 ms -> Calls per second : 10000000 calls [05:17:50] MRandom -> Average time per call : 108 ns -> Total execution time : 54 ms -> Calls per second : 9259259 calls [05:17:50] random -> Average time per call : 112 ns -> Total execution time : 56 ms -> Calls per second : 8928571 calls [05:17:50] random -> Average time per call : 106 ns -> Total execution time : 53 ms -> Calls per second : 9433962 calls [05:17:50] MRandom -> Average time per call : 98 ns -> Total execution time : 49 ms -> Calls per second : 10204082 calls [05:17:50] MRandom -> Average time per call : 100 ns -> Total execution time : 50 ms -> Calls per second : 10000000 calls [06:48:44] random -> Average time per call : 104 ns -> Total execution time : 52 ms -> Calls per second : 9615385 calls [06:48:44] random -> Average time per call : 108 ns -> Total execution time : 54 ms -> Calls per second : 9259259 calls [06:48:44] MRandom -> Average time per call : 100 ns -> Total execution time : 50 ms -> Calls per second : 10000000 calls [06:48:44] MRandom -> Average time per call : 98 ns -> Total execution time : 49 ms -> Calls per second : 10204082 calls [06:48:44] random -> Average time per call : 106 ns -> Total execution time : 53 ms -> Calls per second : 9433962 calls [06:48:44] random -> Average time per call : 106 ns -> Total execution time : 53 ms -> Calls per second : 9433962 calls [06:48:45] MRandom -> Average time per call : 98 ns -> Total execution time : 49 ms -> Calls per second : 10204082 calls [06:48:45] MRandom -> Average time per call : 102 ns -> Total execution time : 51 ms -> Calls per second : 9803922 calls
I compiled the linux version and gave it a go.. seems to work well. It would be nice if the native random() worked this well.
|
I agree the default pawn random is nothing compared to this algorithm. I love when people ask me why I even made this, it makes me wonder if they every really used the pawn random. I know I use it very often on my game mode and it shows especially to players that play on a daily basis.
|
Unfortunately I did miss a couple bugs the first time around. :S Its highly recommend to download this version. http://www.sendspace.com/file/j7en2j (First post link also updated) Fixed: MRandom not behaving like the default PAWN random i.e MRandom(2) now returns 0,1 not 0,1,2 (sorry if people started changing there scripts I really wanted that fixed before release.....it just slipped my mind) Fixed: MRandRange was returning garbage/not working this is fixed. NOTE: An added note while I was doing some extra testing I found out if you do MRandFloatRange(1.0, max) you could possibly end up with a float value less than 1.0 an easy work around for this is to pad it with a few more decimal places i.e MRandFloatRange(1.0000, max) will not dip below 1.0 (at least it didn't in several hundred calls) |
new
Float:x,
Float:y,
Float:z;
MRandFloatRange(408.7256, 2849.402, x); // min and max X coord's
MRandFloatRange(-1167.788, -1891.816, y); // min and max Y coord's Creates an area around Los Santos
MapAndreas_FindZ_For2DCoord(x, y, z); // finds the ground level for the previous X and Y coord.
somevar = CreatePickup(1212, 2, x, y, z, -1); //Creates a money packet pickup somewhere in Los Santos
[17:40:03] random -> Average time per call : 144 ns -> Total execution time : 72 ms -> Calls per second : 6944444 calls [17:40:03] random -> Average time per call : 120 ns -> Total execution time : 60 ms -> Calls per second : 8333333 calls [17:40:04] MRandom -> Average time per call : 120 ns -> Total execution time : 60 ms -> Calls per second : 8333333 calls [17:40:04] MRandom -> Average time per call : 116 ns -> Total execution time : 58 ms -> Calls per second : 8620689 calls [17:40:04] MRandFloatRange -> Average time per call : 170 ns -> Total execution time : 85 ms -> Calls per second : 5882353 calls [17:40:04] MRandFloatRange -> Average time per call : 162 ns -> Total execution time : 81 ms -> Calls per second : 6172839 calls [17:40:04] random -> Average time per call : 116 ns -> Total execution time : 58 ms -> Calls per second : 8620689 calls [17:40:04] random -> Average time per call : 118 ns -> Total execution time : 59 ms -> Calls per second : 8474576 calls [17:40:04] MRandom -> Average time per call : 112 ns -> Total execution time : 56 ms -> Calls per second : 8928571 calls [17:40:04] MRandom -> Average time per call : 114 ns -> Total execution time : 57 ms -> Calls per second : 8771930 calls [17:40:04] MRandFloatRange -> Average time per call : 170 ns -> Total execution time : 85 ms -> Calls per second : 5882353 calls [17:40:04] MRandFloatRange -> Average time per call : 162 ns -> Total execution time : 81 ms -> Calls per second : 6172839 calls
Why can't you just do:
Код:
return amx_ftoc(seed); pawn Код:
|
Also, you have many files in the download which don't need to be included and will greatly reduce the size:
|