private static ImmutableDictionary <string, string> GetRandomImageOptions(int numberOfOptions) { var randomOptions = ImmutableDictionary.CreateBuilder <string, string>(); var availableOptions = Assets.Images.ToList(); var crypto = new CryptoHelper(); for (var i = 0; i < numberOfOptions; i++) { var randomItem = availableOptions[crypto.GetRandomIndex(availableOptions.Count)]; randomOptions.Add(randomItem.Key, crypto.GetRandomString(20)); availableOptions.Remove(randomItem); // We don't want duplicate entries } return(randomOptions.ToImmutable()); }
private static ImmutableDictionary<string, string> GetRandomImageOptions(int numberOfOptions) { var randomOptions = ImmutableDictionary.CreateBuilder<string, string>(); var availableOptions = Assets.Images.ToList(); var crypto = new CryptoHelper(); for (var i = 0; i < numberOfOptions; i++) { var randomItem = availableOptions[crypto.GetRandomIndex(availableOptions.Count)]; randomOptions.Add(randomItem.Key, crypto.GetRandomString(20)); availableOptions.Remove(randomItem); // We don't want duplicate entries } return randomOptions.ToImmutable(); }