public Result GetResult() { var random = new Bogus.Randomizer(); return(new Result() { Prop1 = (decimal)random.Number(10000, 2564789), Prop2 = (decimal)random.Number(10000, 2564789), Prop3 = (decimal)random.Number(10000, 2564789), Prop4 = (decimal)random.Number(10000, 2564789), Prop5 = (decimal)random.Number(10000, 2564789), }); }
public RequestDto GetRequest() { var random = new Bogus.Randomizer(); var lorem = new Bogus.DataSets.Lorem(); var subRequest = new Faker <SubRequestDto>() .RuleFor(first => first.Name, f => lorem.Text()) .RuleFor(first => first.ChildID, f => random.Number(1990, 2030)) .RuleFor(first => first.DateOfBirth, f => f.Date.Recent(100)); var requestDto = new RequestDto() { Year = random.Number(1990, 2030), Denomination1 = lorem.Text(), Denomination2 = lorem.Text(), MaritalStatus = random.Word(), SubRequests = subRequest.Generate(2), Income = (decimal)random.Number(10000, 2564789), QualifiedProp = (decimal)random.Number(10000, 2564789), QualifiedProp2 = (decimal)random.Number(10000, 2564789), SomeProp = (decimal)random.Number(10000, 2564789), SomeProp2 = (decimal)random.Number(10000, 2564789), SomeProp3 = (decimal)random.Number(10000, 2564789), Shortname = random.Word(), SomeProp22 = random.Word(), }; return(requestDto); }
// Start is called before the first frame update public void Start() { //When initialized must determine what game flags are so certain types of boxes can be spawned box = Small_box; var random = new Bogus.Randomizer(); int num = random.Number(1, 2); if (num == 1 && !coworker) { pos = new Vector3(9.5f, 9f, 0f); } else if (num == 2 && !coworker) { pos = new Vector3(11.5f, 9f, 0f); } else if (coworker) { //if the coworker is missing spawn a box on his line pos = new Vector3(-15f, 1.8f, 0f); } num = random.Number(1, 2); GeneratePackage(); GenerateAnswer(num); //pick a random box sprite to look as and instantiate num = random.Number(1, 4); switch (num) { case 1: box.GetComponent <SpriteRenderer>().sprite = b; break; case 2: box.GetComponent <SpriteRenderer>().sprite = b1; break; case 3: box.GetComponent <SpriteRenderer>().sprite = b2; break; case 4: box.GetComponent <SpriteRenderer>().sprite = b3; break; } box = Instantiate(box, pos, Quaternion.identity); box.transform.parent = transform; }
// Update is called once per frame void FixedUpdate() { if (GameData.coworker) { rend.enabled = true; } if (m_LastPressTime + m_PressDelay < Time.unscaledTime && GameData.coworker) { var x = Instantiate(box, new Vector3(-15f, 1.8f, 0f), Quaternion.identity); m_LastPressTime = Time.unscaledTime; boxes.Add(x); } if (boxes != null) { foreach (var b in boxes) { if (b.transform.position.x < -4f) { b.transform.position += new Vector3(0.05f, 0f, 0f); if (b.transform.position.x > -5f && b.transform.position.x < -4.98f) { Debug.Log("try"); Co.SetTrigger("DropOff"); } } else if (b.transform.position.x < -1.5) { b.transform.position += new Vector3(0.04f, 0f, 0f); } else { var random = new Bogus.Randomizer(); int num = random.Number(1, 2); if (num == 1) { b.transform.position += new Vector3(0f, 0.04f, 0f); } else { b.transform.position += new Vector3(0f, 0.04f, 0f); } } if (b.transform.position.y < -1 || b.transform.position.y > 4) { Destroy(b); var index = boxes.IndexOf(b); boxes.RemoveAt(index); break; } } } }
public void GenerateAnswer(int num) { //if num is 1 generate 1 false answer if not set the answer to the values already asssigned var random = new Bogus.Randomizer(); var data = new Bogus.DataSets.Commerce("en"); var local = new Bogus.DataSets.Address("en"); var user = new Bogus.DataSets.Name("en"); reject = false; zipA = zip; addressA = address; nameA = name; IDA = ID; itemA = item; if (num == 1) { reject = true; int numb = random.Number(1, 5); if (numb == 1) { zipA = zip = local.ZipCode(); } if (numb == 2) { address = local.StreetAddress(); } if (numb == 3) { ID = random.Number(1, 9999); } if (numb == 4) { item = data.Product(); } else { name = user.FullName(); } } }
public void GeneratePackage() { //assigns random data to the box the player must check matches screen var random = new Bogus.Randomizer(); var data = new Bogus.DataSets.Commerce("en"); var local = new Bogus.DataSets.Address("en"); var user = new Bogus.DataSets.Name("en"); zip = local.ZipCode(); address = local.StreetAddress(); ID = random.Number(1, 9999); item = data.Product(); name = user.FullName(); }
public void UpdatePhone(RaycastHit2D hit) { var c = hit.collider; var x = c.transform.parent.gameObject.name; switch (x) { case ("Alarm"): if (AlarmC <= money) { buy.Play(); hasAlarm = true; money -= AlarmC; GameData.ase = true; Destroy(AlarmGO); } break; case ("ExerciseBike"): if (money >= BikeC) { buy.Play(); hasBike = true; money -= BikeC; GameData.bse = true; Destroy(BikeGO); } break; case ("Fridge"): if (money >= fCost[F]) { buy.Play(); GameData.fse = true; FridgeSprite.sprite = fridge[F]; money -= fCost[F]; maxFood += Fbonus[F]; F += 1; } if (F == 3) { Destroy(FridgeGO); F = 2; } break; case ("Bed"): if (money >= bCost[B]) { buy.Play(); GameData.bese = true; BedSprite.sprite = bed[B]; money -= bCost[B]; B += 1; } if (B == 3) { Destroy(BedGO); B = 2; } break; case ("Coffee"): if (money >= cCost[C]) { buy.Play(); GameData.cse = true; CoffeeSprite.sprite = coffee[C]; money -= cCost[C]; C += 1; } if (C == 3) { Destroy(CoffeeGO); C = 2; } break; case ("Mask"): if (money >= mCost[M]) { buy.Play(); money -= mCost[M]; M += 1; GameData.hasmask = true; } if (M == 4) { Destroy(MaskGO); M = 3; } break; case ("Food"): if (FoodC <= money && (GameData.food + 40) < GameData.maxfood) { buy.Play(); money -= FoodC; food += 40; } break; } if (hit.collider.gameObject.name == "Door") { if (GameData.food > 0) { GameData.dayswofood = 0; } if (GameData.day >= 3) { var random = new Bogus.Randomizer(); int num = random.Number(1, 4); if (num == 1) { GameData.isill = true; } } else { GameData.isill = false; } door.Play(); CalculateEnergy(); if (!hasAlarm) { var random = new Bogus.Randomizer(); int num = random.Number(1, 4 - GameData.m); if (num == 1) { GameData.hour = 12; GameData.energy = GameData.Maxenergy; GameData.late = true; } else { GameData.hour = 9; GameData.energy = GameData.Maxenergy * 0.8f; GameData.late = false; } } else { GameData.hour = 9; GameData.energy = GameData.Maxenergy * 0.8f; GameData.late = false; } GameData.day = GameData.day + 1; GameData.b = B; GameData.f = F; GameData.c = C; GameData.m = M; StartCoroutine(LoadScene()); } }
protected override void Seed(ApplicationDbContext context) { base.Seed(context); int movieCount = 20; int crewCount = 40; //weight actors 0.8 directors 0.2 int reviewCount = 20; int userCount = 30; #region UserRoles const string adminRoleName = "Admin"; const string userRoleName = "UserNormal"; var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); var adminRole = new IdentityRole { Name = adminRoleName }; var userRole = new IdentityRole { Name = userRoleName }; roleManager.Create(adminRole); roleManager.Create(userRole); #endregion #region Users var store = new UserStore <ApplicationUser>(context); var manager = new UserManager <ApplicationUser>(store); #region Admin user account var admin = new ApplicationUser() { Id = Guid.NewGuid().ToString(), UserName = "******", Email = "*****@*****.**", EmailConfirmed = true }; var checkAdminUser = manager.Create(admin, "pass123"); if (checkAdminUser.Succeeded) { manager.AddToRole(admin.Id, adminRoleName); } else { var errors = checkAdminUser.Errors; errors.ForEach(e => Debug.WriteLine(e)); } #endregion var users = new Faker <ApplicationUser>() .Rules((f, u) => { var userEmail = f.Internet.Email(); u.Id = Guid.NewGuid().ToString(); u.AvatarUri = f.Internet.Avatar(); u.DisplayName = f.Name.FullName(); u.UserName = userEmail; u.Email = userEmail; u.EmailConfirmed = true; }) .Generate(userCount); users.ForEach(u => { var checkUser = manager.Create(u, "pass123"); if (checkUser.Succeeded) { manager.AddToRole(u.Id, userRoleName); } else { checkUser.Errors.ForEach(e => Debug.WriteLine(e)); } }); #endregion #region Gernes string[] genreNames = { "Action", "Action", "Adventure", "Comedy", "Crime", "Drama", "Fantasy", "Horror", "Romance", "Science fiction", "Thriller" }; context.Genres.AddRange(genreNames.Select(genre => new Genre() { Title = genre })); #endregion #region Movies var random = new Bogus.Randomizer(); var reviewGenerator = new Faker <Review>() .Rules((f, r) => { r.AuthorId = f.PickRandom(users.Select(u => u.Id)); r.Title = f.Lorem.Sentence(); r.Body = f.Lorem.Sentences(); r.CreatedOn = f.Date.Past(); r.Rating = f.Random.Float(0, 10); }); var movies = new Faker <Movie>() .Rules((f, m) => { m.Title = f.Hacker.Adjective() + " " + f.Hacker.Noun(); m.Year = f.Random.Int(2000, 2018); m.Length = f.Random.Int(60, 180); m.Rating = f.Random.Float(0f, 10f); m.Image = f.Image.PicsumUrl(320, 320); m.Description = f.Lorem.Sentences(); m.Reviews = reviewGenerator.Generate(random.Int(3, 8)); m.Comments = Get20Comments(); m.Reviews.ForEach(r => r.Comments = Get20Comments()); }) .Generate(movieCount); //movies = Enumerable.Range(0, movieCount).Zip(movies, (i, m) => //{ // m.Reviews.ForEach(r => r.MovieId = i); // m.Id = i; // return m; //}).ToList(); #endregion #region FilmCrewMember var crew = new Faker <FilmCrewMember>() .Rules((f, c) => { c.Bio = f.Lorem.Sentences(); c.DoB = f.Date.Past(60, new DateTime(1990, 2, 15)); c.ImageUri = f.Internet.Avatar(); c.Name = f.Name.FullName(); c.Role = (MovieRole)f.Random.WeightedRandom(new int[] { 0, 1 }, new float[] { 0.8f, 0.2f }); c.Comments = Get20Comments(); }) .Generate(crewCount); var moviesArr = movies.ToList(); crew.ForEach(c => c.Movies = random.ListItems <Movie>(moviesArr, random.Number(3, 10))); context.FilmCrewMembers.AddRange(crew); #endregion List <Comment> Get20Comments() { var comments = new Faker <Comment>() .Rules((f, c) => { c.AuthorId = f.PickRandom(users.Select(u => u.Id)); c.CommentBody = f.Lorem.Sentences(); c.CreatedOn = f.Date.Past(); }) .Generate(20); var parentCommentsCount = random.Int(8, 13); var parentComments = comments.Take(parentCommentsCount).ToArray(); var childrenComments = comments.Skip(parentCommentsCount).ToArray(); childrenComments.ForEach(c => c.CommentParentId = random.Number(0, 2)); return(parentComments.Concat(childrenComments).ToList()); } context.Users.ForEach(u => u.EmailConfirmed = true); context.SaveChanges(); }
static void Main(string[] args) { Randomizer.Seed = new Random(3897234); var random = new Bogus.Randomizer(); var guildNames = new[] { null, "Guild A", "Guild B", "Guild C", "Guild D", "Guild E" }; var faction = new [] { "Horde", "Alliance", "Undefined" }; var race = new[] { "Human", "Kaldorei", "Gnome", "Dwarf", "Worgen", "Orc", "Tauren", "Forsaken", "Sindorei", "Goblin", "Pandaren" }; var isActive = new[] { true, false }; var dateInfo = new Faker <DateInfo>() .StrictMode(true) .RuleFor(x => x.CreatedDate, f => f.Date.Recent()) .RuleFor(x => x.UpdatedDate, f => f.Date.Recent()); var story = new Faker <Story>() .StrictMode(true) .RuleFor(x => x.Body, f => f.Lorem.Paragraphs(3)) .RuleFor(x => x.Id, f => f.IndexFaker) .RuleFor(x => x.Title, f => f.Lorem.Sentence()) .RuleFor(x => x.DateInfo, f => dateInfo.Generate()); var picture = new Faker <Picture>() .StrictMode(true) .RuleFor(x => x.Id, f => f.IndexFaker) .RuleFor(x => x.Caption, f => f.Lorem.Sentence()) .RuleFor(x => x.Url, f => f.Internet.Url()); var guild = new Faker <Guild>() .StrictMode(true) .RuleFor(x => x.Name, f => f.PickRandom(guildNames)) .RuleFor(x => x.Description, f => f.Lorem.Paragraphs(3)); var character = new Faker <Character>() .StrictMode(true) .RuleFor(x => x.Id, f => f.IndexFaker) .RuleFor(x => x.FirstName, f => f.Name.FirstName()) .RuleFor(x => x.LastName, f => f.Name.LastName()) .RuleFor(x => x.EyeColor, f => f.Commerce.Color()) .RuleFor(x => x.EyeColor, f => f.Commerce.Color()) .RuleFor(x => x.Weight, f => f.Lorem.Sentence()) .RuleFor(x => x.Height, f => f.Lorem.Sentence()) .RuleFor(x => x.SkinColor, f => f.Commerce.Color()) .RuleFor(x => x.Race, f => f.PickRandom(race)) .RuleFor(x => x.Faction, f => f.PickRandom(faction)) .RuleFor(x => x.Background, f => f.Lorem.Paragraphs(7)) .RuleFor(x => x.Residence, f => f.Lorem.Word()) .RuleFor(x => x.Occupation, f => f.Lorem.Sentence()) .RuleFor(x => x.PhysicalAppearance, f => f.Lorem.Paragraphs(2)) .RuleFor(x => x.Friends, f => f.Lorem.Words().ToList()) .RuleFor(x => x.Stories, f => story.Generate(random.Number(1, 10)).ToList()) .RuleFor(x => x.Pictures, f => picture.Generate(random.Number(1, 10)).ToList()) .RuleFor(x => x.Guild, f => guild.Generate()) .RuleFor(x => x.DateInfo, f => dateInfo.Generate()); var user = new Faker <User>() .StrictMode(true) .RuleFor(x => x.UserName, f => f.Internet.UserName()) .RuleFor(x => x.DateInfo, dateInfo.Generate()) .RuleFor(x => x.Email, f => f.Internet.Email()) .RuleFor(x => x.Image, f => f.Internet.Url()) .RuleFor(x => x.IsActive, f => f.PickRandom(isActive)) .RuleFor(x => x.Characters, f => character.Generate(random.Number(1, 10)).ToList()); var users = user.Generate(1000); //string charsJson = JsonConvert.SerializeObject(users); ElasticClient client = ElasticClientFactory.GetClient(); //File.WriteAllText(@"c:\dump\users.txt", charsJson); var result = client.Bulk(b => b.IndexMany(users)); if (!result.IsValid) { foreach (var item in result.ItemsWithErrors) { Console.WriteLine("Failed to index document {0}: {1}", item.Id, item.Error); } Console.WriteLine(result.DebugInformation); Console.Read(); Environment.Exit(1); } Console.WriteLine("Done!"); Console.ReadLine(); }
protected override void Seed(MyContext context) { AppUser admin = new AppUser(); admin.UserName = "******"; admin.Password = "******"; admin.Email = "*****@*****.**"; context.AppUsers.Add(admin); context.SaveChanges(); AppUserDetail admind = new AppUserDetail(); admind.ID = admin.ID; admind.FirstName = "Berke"; admind.LastName = "Güzel"; admind.Address = "Maltepe"; context.AppUserDetails.Add(admind); context.SaveChanges(); AppUser member = new AppUser(); member.UserName = "******"; member.Password = "******"; member.Email = "*****@*****.**"; context.AppUsers.Add(member); context.SaveChanges(); AppUserDetail memberd = new AppUserDetail(); memberd.ID = member.ID; memberd.FirstName = "Berke"; memberd.LastName = "Güzel"; memberd.Address = "Maltepe"; context.AppUserDetails.Add(memberd); context.SaveChanges(); for (int i = 0; i < 10; i++) { AppUser ap = new AppUser(); ap.UserName = new Internet("tr").UserName(); ap.Password = new Internet("tr").Password(); ap.Email = new Internet("tr").Email(); context.AppUsers.Add(ap); context.SaveChanges(); AppUserDetail apd = new AppUserDetail(); apd.ID = ap.ID; apd.FirstName = new Name("tr").FirstName(); apd.LastName = new Name("tr").LastName(); apd.Address = new Address("tr").Locale; context.AppUserDetails.Add(apd); context.SaveChanges(); } //for (int i = 0; i < 11; i++) //{ // AppUserDetail apd = new AppUserDetail(); // apd.ID = i; // apd.FirstName = new Name("tr").FirstName(); // apd.LastName = new Name("tr").LastName(); // apd.Address = new Address("tr").Locale; // context.AppUserDetails.Add(apd); //} //context.SaveChanges(); for (int i = 0; i < 10; i++) { Category c = new Category(); c.CategoryName = new Commerce("tr").Categories(1)[0]; c.Description = new Lorem("tr").Sentence(100); for (int x = 0; x < 50; x++) { Randomizer random = new Bogus.Randomizer(); Product p = new Product(); p.ProductName = new Commerce("tr").ProductName(); p.UnitPrice = Convert.ToDecimal(new Commerce("tr").Price()); p.ImagePath = new Images("en").Nightlife(); p.UnitsInStock = Convert.ToInt16(random.Number(1, 500)); p.Description = new Lorem("tr").Sentence(5); c.Products.Add(p); } context.Categories.Add(c); context.SaveChanges(); } }
void OnTriggerEnter2D(Collider2D c) { //when the collider of the stamp triggers on a package stamp with a random corresponding stamp if (c.GetComponent <BoxCollider2D>().tag == "Package" && isgrabbed) { boxRend = c.transform.Find("stamped").gameObject.GetComponent <SpriteRenderer>(); var x = c.GetComponent <BoxCollider2D>().transform.parent.gameObject; data = x.GetComponent("PackageData") as PackageData; var random = new Bogus.Randomizer(); int num = random.Number(1, 3); if (approved) { if (num == 1) { boxRend.sprite = a1; } else if (num == 2) { boxRend.sprite = a2; } else { boxRend.sprite = a3; } snd.Play(); } else { if (num == 1) { boxRend.sprite = r1; } else if (num == 2) { boxRend.sprite = r2; } else { boxRend.sprite = r3; } snd.Play(); } boxRend.enabled = true; data.accepted = approved; } if (m_LastPressTime + m_PressDelay < Time.unscaledTime) { //if stamp triggers witht the stamp box change the stamp to red or green m_LastPressTime = Time.unscaledTime; if (c.gameObject.name == "Reject Pad" && isgrabbed) { rend.sprite = red; approved = false; snd.Play(); } else if (c.gameObject.name == "Approve Pad" && isgrabbed) { rend.sprite = green; approved = true; snd.Play(); } } }