Ejemplo n.º 1
0
        public static TripAdvisorDatabase GenerateTripAdvisorDataBase(Random R, int dbSize)
        {
            var result = new TripAdvisorDatabase
            {
                Ids       = new Guid[dbSize],
                Countries = new Dictionary <Guid, string>(),
                Names     = new Dictionary <Guid, string> [R.Next(3, 6)],
                Prices    = new Dictionary <Guid, string>(),
                Ratings   = new Dictionary <Guid, string>()
            };

            for (int i = 0; i < result.Names.Length; i++)
            {
                result.Names[i] = new Dictionary <Guid, string>();
            }

            for (int i = 0; i < dbSize; i++)
            {
                Guid guid = Guid.NewGuid();
                result.Ids[i] = guid;
                result.Names[R.Next(result.Names.Length)][guid] = DBGeneratorUtils.AnyFromArray(R, tripAdvisorNames);
                result.Prices[guid]    = valuesMap[(R.Next(1, 80) * 5)];
                result.Ratings[guid]   = valuesMap[R.Next(1, 6)];
                result.Countries[guid] = tripAdvisorCountries[R.Next(0, tripAdvisorCountries.Length * 2 - 1) / 2];
            }
            return(result);
        }
Ejemplo n.º 2
0
 static BSTNode CreateNode(Random R)
 {
     return(new BSTNode()
     {
         UserName = $"{DBGeneratorUtils.AnyFromArray(R, usernamePrefix)}{DBGeneratorUtils.AnyFromArray(R, usernameBase)}{DBGeneratorUtils.AnyFromArray(R, usernameSuffix)}",
         Review = DBGeneratorUtils.AnyFromArray(R, reviews)
     });
 }
Ejemplo n.º 3
0
 private static ListNode GenerateRoom(Random R)
 {
     return(new ListNode()
     {
         Name = DBGeneratorUtils.AnyFromArray(R, bookingNames),
         Price = valueMap[R.Next(2, 20) * 10 - (R.NextDouble() < 0.7 ? 1 : 0)],
         Rating = valueMap[R.Next(1, 6)]
     });
 }
        private static PhotMetadata GeneratePhotoData(Random R)
        {
            var result = new PhotMetadata()
            {
                Camera         = DBGeneratorUtils.AnyFromArray(R, cameras),
                Name           = DBGeneratorUtils.AnyFromArray(R, namePrefix) + DBGeneratorUtils.AnyFromArray(R, nameBase) + ".jpg",
                CameraSettings = GetCameraSettings(R),
                Date           = new DateTime(2004, 1, 1).AddDays(R.Next(365 * 16)),
            };

            (result.Longitude, result.Latitude) = GetRandomLatLong(R);
            int pixelIdx = R.Next(pixelWidths.Length);

            result.WidthPx  = pixelMap[pixelWidths[pixelIdx]];
            result.HeightPx = pixelMap[pixelHeights[pixelIdx]];
            return(result);
        }