Not sure why you're using modulo.
Instead of multiplying both people by a ratio, i suggest a different approach:
1) figure out how many balls are changing hands (use your rounding logic here)
2) take those balls away from giver
3) give those balls to receiver
eg:
Code
class Person{
private int _balls;
void takeAwayBalls(int balls){
_balls -+ balls;
}
void giveBalls(int balls){
_balls += balls;
}
void giveBallsTo(Person receiver, double ratio){
int ballsToGive = magicalroundfunction(ratio * _balls);
this.takeAwayBalls(ballsToGive);
marc.giveBalls(ballsToGive);
}
}
where magicalroundfunction is whatever your rounding logic is.
use some better naming convention