Random is bugged or something like this
#1

Hi
I know it should work perfect bat for example playing
4 players and selection should be random, bat it doesn't always player 2 will be zombie
Код:
public RandomZombie() return Half();
stock Half()
{
	new Humans;
	foreach(new i : Player) {

	    if(Humans < 2 && random(100) < 70 )
	    {
	        HumanSetup(i);
	        printf("Selected humans");
	        Humans ++;
	       }
               else
               {
	        ZombieSetup2(i);
	        printf("Selected zombies");
	        Humans = 0;
	    }
	}
	printf("Finished Selecting teams");
	return 1;
}
Ideas why?
Reply
#2

Humans = 0;

why you resetting it?
Reply
#3

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Humans = 0;

why you resetting it?
So how should it be?
Reply
#4

before answering the question I want to clear some things.

Is the order of selection is same always? Not just for player 2 ?
can you show what your debug printed?
You are trying to balance the team right?
Reply
#5

For make it more clear i will explain it better. Playing 4 players
Names
Name_Name (Id 0)
Second_Second (Id 1)
Third_Third (Id 2)
Fourth_Fourth (Id 3)
Weird think that always player with id 2 will be selected as zombie. I tested about 20 times and he never was Human

Код:
Printed:
[13:42:29] Selected zombies
[13:42:29] Finished Selecting teams
[13:42:29] Selected humans
[13:42:29] Finished Selecting teams
[13:42:30] Selected zombies
[13:42:30] Finished Selecting teams
[13:42:30] Selected humans
[13:42:30] Finished Selecting teams
[13:42:31] Selected humans
[13:42:31] Finished Selecting teams
[13:42:31] Selected zombies
[13:42:31] Finished Selecting teams
[13:42:32] Selected humans
[13:42:32] Finished Selecting teams
[13:42:49] Selected humans
[13:42:49] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:51] Selected humans
[13:42:51] Finished Selecting teams
[13:42:52] Selected humans
[13:42:52] Finished Selecting teams
Yes i try balance it.
Reply
#6

I think it was just a accident
Reply
#7

Quote:
Originally Posted by Pokemon64
Посмотреть сообщение
I think it was just a accident
I dont think so. I call accident when you got selected 3-4 times bat not 20 times
Reply
#8

Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
Reply
#9

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
Bump
Reply
#10

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
Well okay.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)