[Plugin] [REL] MerRandom v2.0 - Mersenne Twister Randoms
#41

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.
Reply
#42

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 =)
Reply
#43

Great Job, Dude. Is awesome !
Reply
#44

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.
Reply
#45

Another nice plugin Good Job!
Reply
#46

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

I have just started using it for my roulette system
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)