예제 #1
0
        // Picks ranks based on their default percentiles (Where the highest rank is the most likely to appear and it goes down from there)
        private static int GetRandomRank(ref Random rand, ImageType imageType)
        {
            Debug.WriteLine("Searching for: " + imageType);
            // the percentiles for weighted ranks change everytime an image's rank is altered or if the image type is not none
            if ((WallpaperData.potentialWeightedRankUpdate && OptionsData.ThemeOptions.WeightedRanks) || WallpaperData.potentialRegularRankUpdate || imageType != ImageType.None)
            {
                WallpaperData.UpdateRankPercentiles(imageType); //? this method sets the above booleans to false
            }

            Dictionary <int, double> modifiedRankPercentiles = WallpaperData.GetRankPercentiles(imageType);

            return(rand.NextInWeightedArray(modifiedRankPercentiles.Keys.ToArray(), modifiedRankPercentiles.Values.ToArray()));
        }