I am working on a personal project where a user can generate various unique combinations of images in a program.
There are 3 layers, one is the background, the second is a character layer, and the last one is an accessory layer. There are 5 different backgrounds, 29 different characters, and 11 different accessories. When the user inputs the total number of images to generate, the program will take one random background, character, and accessory and composite a new image out of them. Each background image, character image, and accessory image have different weights (or one image is more likely to be used in the composition than the other) for example a blue background has a weight of 10, a green one 20, yellow 50, etc.
My question is, how would you work out the rarity of a composition having a specific combination of images. Say a blue background, a zombie character, and a hat accessory. The blue background having a weight of 10, the zombie having a weight of 5, and the hat having a weight of 10. How rare would that combination be? (For example, that combination has a 3% rarity or 3 in 100 chance of being generated)
The solution I have come up with is as follows:
Sum all the weights together, divide it by 300 (because the maximum weight is 100, and there are 3 different layers so 3*100)
Take the answer and multiply it by 100 to get the percentage.
10+5+10 = 25
25/300 = 0.083
0.083*100 = 8.3%
(The combination has an 8.3% or 8 in 100 chance of being generated)
Is this solution correct?
There are 3 layers, one is the background, the second is a character layer, and the last one is an accessory layer. There are 5 different backgrounds, 29 different characters, and 11 different accessories. When the user inputs the total number of images to generate, the program will take one random background, character, and accessory and composite a new image out of them. Each background image, character image, and accessory image have different weights (or one image is more likely to be used in the composition than the other) for example a blue background has a weight of 10, a green one 20, yellow 50, etc.
My question is, how would you work out the rarity of a composition having a specific combination of images. Say a blue background, a zombie character, and a hat accessory. The blue background having a weight of 10, the zombie having a weight of 5, and the hat having a weight of 10. How rare would that combination be? (For example, that combination has a 3% rarity or 3 in 100 chance of being generated)
The solution I have come up with is as follows:
Sum all the weights together, divide it by 300 (because the maximum weight is 100, and there are 3 different layers so 3*100)
Take the answer and multiply it by 100 to get the percentage.
10+5+10 = 25
25/300 = 0.083
0.083*100 = 8.3%
(The combination has an 8.3% or 8 in 100 chance of being generated)
Is this solution correct?