SA-MP Forums Archive
[Plugin] [REL] MerRandom v2.0 - Mersenne Twister Randoms - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MerRandom v2.0 - Mersenne Twister Randoms (/showthread.php?tid=109196)

Pages: 1 2 3


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - MisterTickle - 22.09.2011

I've been using this plugin for a long time but I swear something is wrong with the last value I've noticed while doing while doing some last minute beta testing.

Code:
        new number = MRandom(2);
        if(number == 0)
        {
            format(str, 128, "M4");
		}
		else if(number == 1)
        {
            format(str 128, "9mm");
		}
		else if(number == 2)
        {
            format(str, 128, "MP5");
		}
The MP5 NEVER gets called. I've tried over 100's of times and I've never seen the MP5 used. Does it needs to be MRandom(3) I thought it had to be 2 and It started from 0. I have seen M4 and 9mm called but NEVER seen MP5 called so I assume this is a bug with the last number and this is the case and EVERY application I have found it for as I use MRandom alot in my script.


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - [L3th4l] - 22.09.2011

Try this:

pawn Code:
switch(MRandom(3))
{
    case 0: strcat(str, "M4", 5);
    case 1: strcat(str, "9mm", 5);
    case 2: strcat(str, "MP5", 5);
}
You are calling for 3 random values, thus having "MRandom(3)". Also, use strcat to copy strings =)


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - aRoach - 22.09.2011

Great Job, Dude. Is awesome !


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - cyber_punk - 22.09.2011

Quote:
Originally Posted by MisterTickle
View Post
I've been using this plugin for a long time but I swear something is wrong with the last value I've noticed while doing while doing some last minute beta testing.

Code:
        new number = MRandom(2);
        if(number == 0)
        {
            format(str, 128, "M4");
		}
		else if(number == 1)
        {
            format(str 128, "9mm");
		}
		else if(number == 2)
        {
            format(str, 128, "MP5");
		}
The MP5 NEVER gets called. I've tried over 100's of times and I've never seen the MP5 used. Does it needs to be MRandom(3) I thought it had to be 2 and It started from 0. I have seen M4 and 9mm called but NEVER seen MP5 called so I assume this is a bug with the last number and this is the case and EVERY application I have found it for as I use MRandom alot in my script.
Quote:
Originally Posted by [L3th4l]
View Post
Try this:

pawn Code:
switch(MRandom(3))
{
    case 0: strcat(str, "M4", 5);
    case 1: strcat(str, "9mm", 5);
    case 2: strcat(str, "MP5", 5);
}
You are calling for 3 random values, thus having "MRandom(3)". Also, use strcat to copy strings =)

Lethal is right you need MRandom(3)

OffTopic:
If that is a fresh string you created why format or copy at all just do
Code:
str = "value";
just make sure the string size is +1 for EOS if you do reuse that variable just ignore my comment, if however say above the code you show you do declare new str[size] it is much faster to do it my way. It works fine I do it often.


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - Edvin - 22.09.2011

Another nice plugin Good Job!


Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - Kyle - 27.06.2012

Just bumping this thread to say how good it actually is and more people should use it!


Respuesta: [REL] MerRandom v2.0 - Mersenne Twister Randoms - Siralos - 15.08.2012

I have just started using it for my roulette system