Make pixeldrain more round

This commit is contained in:
2021-08-17 18:02:46 +02:00
parent a7bf875dcc
commit 05d477d53b
8 changed files with 45 additions and 35 deletions

View File

@@ -78,10 +78,10 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
// Intn returns a number up to n, but never n itself. So to get a random 0
// or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc
switch i := rand.Intn(4); i {
case 0: // 25%
switch i := rand.Intn(5); i {
case 0: // 20%
vd.AdBannerType = brave
case 2, 3, 4: // 75%
case 1, 2, 3, 4: // 80%
vd.AdBannerType = aAds
default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))