GetRandomString() private method

private GetRandomString ( int length ) : string
length int
return string
Esempio n. 1
0
 /// <summary>
 /// Retrieve object containing information needed by client-side library
 /// </summary>
 public FrontEndData GetFrontEndData()
 {
     var crypto = new CryptoHelper();
     return new FrontEndData
     {
         Values = PossibleImageOptions.Select(option => option.Value).ToList(),
         ImageName = ValidImageOption.Key,
         ImageFieldName = crypto.GetRandomString(20),
         AudioFieldName = crypto.GetRandomString(20)
     };
 }
Esempio n. 2
0
        /// <summary>
        /// Retrieve object containing information needed by client-side library
        /// </summary>
        public FrontEndData GetFrontEndData()
        {
            var crypto = new CryptoHelper();

            return(new FrontEndData
            {
                Values = PossibleImageOptions.Select(option => option.Value).ToList(),
                ImageName = ValidImageOption.Key,
                ImageFieldName = crypto.GetRandomString(20),
                AudioFieldName = crypto.GetRandomString(20)
            });
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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();
        }