Map percentage of tile types to int amount

Viewed 8

I have a map of variable dimensions. For example, it has 86 tiles. And I have a different amount of tile types, for example, 5 types (A, B, C, D, E). We know the percentage of each tile type in the map. For example:

  • 20% of type A
  • 10% of type B
  • 10% of type C
  • 30% of type D
  • 30% of type E

What I want to know is the integer amount of tiles of each type. ! I can't round to int or the total of tiles will be (in this example) 87... I can try to fix the result at the end, but I wanted to know if you can think of a better solution.

0 Answers
Related