diff --git a/bench/internal/random/dummy.go b/bench/internal/random/dummy.go index 81720ca4..1d6ee945 100644 --- a/bench/internal/random/dummy.go +++ b/bench/internal/random/dummy.go @@ -2,6 +2,7 @@ package random import ( _ "embed" + "sync" "sync/atomic" "time" @@ -80,20 +81,597 @@ var ( "つくる椅子株式会社", "NextStep Cab", } + initUserNames = []string{ + "Collier6283", + "Miller6106", + "Goldner6682", + "Schneider1218", + "Koss7545", + "Wunsch6118", + "Bauch8259", + "Wiza1083", + "Bernier5481", + "Adams4772", + "Rogahn4930", + "Gibson4831", + "Glover5319", + "Cremin5648", + "Rosenbaum5419", + "Jewess8546", + "Schiller7773", + "Tillman9519", + "Thiel9896", + "Romaguera8747", + "Sauer4603", + "Little2463", + "Ferry5620", + "Fritsch7975", + "Doyle8365", + "Senger3862", + "Russel3117", + "Zemlak4077", + "Morissette6671", + "Abbott2226", + "Schmitt7619", + "Hackett5152", + "Spencer7557", + "Balistreri7654", + "Eichmann1785", + "Reinger6098", + "Nolan2672", + "Bergstrom5257", + "Windler8257", + "Hand6708", + "Raynor6645", + "Kuhic1702", + "Macejkovic2347", + "Zulauf5967", + "Krajcik4871", + "Jacobson5077", + "Lakin3006", + "Murazik9989", + "Prohaska7176", + "Mann1266", + "Goodwin3084", + "Erdman3071", + "Auer2313", + "Ullrich4666", + "Kuhn8857", + "Koepp5553", + "Wiza3899", + "Weimann9061", + "Deckow5697", + "Halvorson2535", + "Jacobs2488", + "Murray1181", + "Feeney5120", + "Cartwright7372", + "Corwin2152", + "Cronin4344", + "Dooley4660", + "Schultz3223", + "Hoeger4249", + "Bogisich8906", + "Doyle4203", + "Braun7047", + "Yost1620", + "Stokes2393", + "Kutch2871", + "Wisoky6211", + "Terry2158", + "Streich5370", + "Balistreri7246", + "Jenkins7756", + "Gleason2560", + "Senger3713", + "Halvorson2846", + "Homenick4802", + "Rice8065", + "Stracke2049", + "Hickle5897", + "Greenholt2897", + "Batz8239", + "Langosh5154", + "Boyer7546", + "Zieme8137", + "Jast1216", + "Wiza8168", + "Kuvalis5133", + "Roberts8136", + "Krajcik7894", + "Lockman8562", + "Leannon7085", + "Mohr4819", + "Ebert9277", + "Rosenbaum3219", + "Russel5654", + "Abernathy4137", + "Gleichner7439", + "McGlynn4661", + "Little6920", + "Sanford7424", + "Kling2472", + "Macejkovic2278", + "Lueilwitz5025", + "Wolf9662", + "Heidenreich1830", + "Kris5001", + "Casper5611", + "Trantow7394", + "Harvey8253", + "Ullrich8738", + "Smitham9637", + "Will8456", + "Cummings7629", + "Maggio8802", + "Kshlerin1997", + "Wolf4684", + "Witting9441", + "Prohaska3338", + "Wyman5446", + "Trantow1133", + "Bins2881", + "Hills5169", + "Halvorson6945", + "Kozey8454", + "Jakubowski4260", + "Walter7648", + "Effertz5087", + "Bartoletti6342", + "Koss4782", + "Bechtelar1131", + "Cummings1884", + "Roob5057", + "Doyle6312", + "Cartwright9750", + "Lakin5553", + "Wehner7820", + "Cummings3944", + "Stroman5930", + "Davis7585", + "Gaylord5267", + "Schiller5919", + "Fisher4181", + "Hammes9552", + "Runolfsson5109", + "Lindgren6160", + "Stanton7006", + "Klein8204", + "Kemmer9220", + "Jerde9599", + "DuBuque7600", + "Gleason3330", + "Boyer9440", + "Brown6024", + "Howell3891", + "Johns5380", + "Dooley9527", + "Parker7053", + "Collins3797", + "Barrows6891", + "Schaden1352", + "Christiansen5051", + "Howell1763", + "Veum7702", + "Powlowski5283", + "Kovacek5336", + "Hermann7125", + "Kilback4271", + "Bartell8139", + "McDermott1805", + "Veum8361", + "Friesen1441", + "Sanford3543", + "Schumm6090", + "Wolff9192", + "Ratke6095", + "Runolfsdottir2790", + "Carter3903", + "Prohaska4376", + "Volkman2638", + "Berge6221", + "Shields1008", + "Reichert6920", + "Anderson1090", + "Kihn3244", + "Wintheiser4782", + "Jakubowski9136", + "Wunsch3821", + "Abernathy5113", + "Volkman1416", + "Nienow7093", + "Stark1670", + "Schneider9905", + "Ziemann7487", + "Runolfsson8579", + "Kemmer6629", + "Stehr5980", + "Ward6753", + "Walsh9821", + "Renner4462", + "Beahan1235", + "Kohler1110", + "Wilderman3936", + "Anderson3981", + "Kunze3687", + "Corkery5627", + "Mosciski7148", + "Altenwerth9596", + "Cremin3942", + "Heller2920", + "Buckridge4285", + "Reichel5791", + "Langworth6501", + "Gleichner7825", + "Donnelly6407", + "Steuber6876", + "Fisher6400", + "Kautzer7315", + "McCullough4848", + "Schuppe8300", + "Monahan6447", + "Jast4329", + "Barrows1212", + "Torp8836", + "Bechtelar6897", + "Hodkiewicz6351", + "Quitzon1924", + "Stanton5063", + "Feest1591", + "Adams7206", + "Connelly9751", + "Rempel8556", + "Halvorson2065", + "Rice1956", + "Bernhard7282", + "Stokes5209", + "Heidenreich7455", + "Hauck8080", + "Erdman4090", + "Schuppe1782", + "Carter9215", + "Hegmann9436", + "Ryan6874", + "Weber8236", + "Block1060", + "Parker2255", + "Shields5143", + "Nienow7148", + "Luettgen1997", + "Williamson5172", + "Pouros8369", + "Gulgowski2603", + "Cummerata3270", + "Tromp1598", + "Turner4332", + "Block5589", + "Will7474", + "Torphy8719", + "Hodkiewicz6336", + "Murphy6232", + "Kshlerin3787", + "Mueller5752", + "Dibbert7357", + "Macejkovic7933", + "Mohr4243", + "Schmidt9799", + "Hayes2587", + "Hettinger8352", + "Tremblay5655", + "Wintheiser3149", + "Wolf4388", + "Breitenberg6231", + "Shanahan5781", + "King2382", + "Welch3489", + "Thompson3912", + "Metz3384", + "Eichmann5653", + "Blick5768", + "Skiles7569", + "Russel7699", + "Kirlin2357", + "Huels8787", + "Wolf2029", + "Reichel3778", + "Waters5550", + "Robel2182", + "Koss2182", + "Crist3541", + "Tillman5701", + "Pfeffer2953", + "Treutel9469", + "Larson4952", + "Blanda9887", + "Dietrich6258", + "Kiehn5940", + "Waelchi6294", + "Fritsch8820", + "Bode2648", + "Davis9341", + "Kozey5568", + "Lind9497", + "OReilly2933", + "Kuhlman9922", + "Lesch1677", + "West3697", + "Emard2039", + "Prohaska6722", + "Jacobi4777", + "Koss7664", + "Corkery9615", + "Windler1387", + "Lockman8598", + "Torp6467", + "Rempel3517", + "Purdy8359", + "Hintz3967", + "Miller9559", + "Beatty1816", + "Medhurst9621", + "Gerhold8674", + "Gibson2468", + "Bogan8115", + "Schimmel2769", + "Turner7474", + "Vandervort2098", + "Osinski4696", + "Jenkins7731", + "Schmidt7552", + "Dietrich1502", + "Upton3519", + "Macejkovic7899", + "Schamberger8807", + "Huels7842", + "Green4987", + "Ziemann9990", + "Kunze8674", + "Donnelly5644", + "Williamson4000", + "Altenwerth5515", + "Keeling3408", + "Bins1454", + "Carter8722", + "Turner7832", + "Anderson4239", + "Sanford9746", + "Purdy9879", + "Homenick5224", + "Klein7281", + "Rau5591", + "Collins1124", + "Bosco7299", + "Weissnat2052", + "Ritchie3987", + "Jakubowski8194", + "Hoppe8034", + "OReilly1709", + "Barrows7645", + "Hamill2625", + "Hoeger7373", + "Wiegand7924", + "Lind8390", + "Robel8939", + "Hyatt7688", + "Parisian2382", + "Blanda9133", + "Hammes2591", + "Daniel8824", + "Johns6801", + "Corwin7170", + "Dooley4990", + "Leuschke1772", + "Anderson1749", + "Walsh8420", + "Greenfelder4904", + "Kessler3776", + "Shields9689", + "Harvey6562", + "Weimann4458", + "Cronin6978", + "Jast9794", + "Schuster7350", + "Ledner4480", + "Will5276", + "Wyman6817", + "Rohan4095", + "King2281", + "Jacobson2422", + "Luettgen2999", + "Kunze5330", + "Tillman7031", + "Runolfsdottir4921", + "Nitzsche9154", + "Stiedemann3406", + "Cronin8266", + "Wolff5267", + "Klein9118", + "Morar3927", + "Murazik5554", + "Wuckert8083", + "Hudson9208", + "Langosh7217", + "Jacobson1446", + "Schmitt5903", + "Rogahn3437", + "Nienow4669", + "Douglas2194", + "Watsica6995", + "Wehner2903", + "Stehr8370", + "Labadie7286", + "Green2950", + "Cummings3575", + "Hoppe4439", + "Wilkinson1380", + "Bailey3812", + "Shanahan8057", + "Kozey7719", + "Fadel8373", + "Cormier4608", + "Rempel2823", + "King7609", + "Walsh4192", + "Mraz1324", + "Mraz5771", + "Emard3819", + "Watsica8147", + "Parker5679", + "Hudson7173", + "Bruen2177", + "Dibbert9800", + "Crist2742", + "Steuber6440", + "Glover5488", + "Corwin2819", + "Christiansen9735", + "Keebler8881", + "Gutmann1571", + "Ankunding4137", + "Lynch6320", + "Rutherford3938", + "Weber1923", + "Wiza4742", + "Ankunding9610", + "Mraz6953", + "Christiansen4038", + "Conroy3198", + "Metz6655", + "Cartwright8204", + "Mueller6331", + "Welch4315", + "Rau2700", + "Hermann6649", + "Runolfsdottir6120", + "Parisian5363", + "Nader7660", + "Bednar6119", + "Schmitt3718", + "Ritchie5206", + "Hintz4622", + "Dach7108", + "Romaguera6419", + "Hartmann4500", + "Grady8253", + "Runolfsdottir5606", + "Reynolds3886", + "Robel5492", + "Schowalter5252", + "Weber6066", + "Fahey7255", + "Walter6040", + "Gislason5863", + "Wolff6851", + "Smith7438", + "Bechtelar8072", + "Rosenbaum7526", + "Raynor5198", + "Dare3839", + "Koss1229", + "Cremin2470", + "Treutel2907", + "Boyle4856", + "Corkery8640", + "Bartoletti9145", + "Herzog2157", + "Kertzmann3715", + "Wintheiser1479", + "Price6118", + "Walker2337", + "Kiehn6869", + "Durgan8266", + "Runte2488", + "Spencer8383", + "Renner2829", + "Kovacek8011", + "Turner1079", + "Goodwin2214", + "Reichert9156", + "Mayer3472", + "Lang4780", + "Lemke1333", + "Mosciski1314", + "Ankunding6481", + "Rolfson3528", + "Beahan9753", + "Kunde8814", + "Weimann5879", + "Kilback9778", + "Hartmann5809", + "Moore5847", + "Kling1466", + "Abbott3770", + "Conroy4167", + "Kuhlman4362", + "Aufderhar3256", + "Torp2074", + "Sauer4924", + "Turner4286", + "Hoppe5969", + "Gislason8371", + "Robel2343", + "Bailey8827", + "Mohr6261", + "Pagac3569", + "Little2009", + "Pagac8849", + "Wehner3146", + "Prosacco4476", + "Marquardt7924", + "Padberg8567", + "Carroll4063", + "Kassulke4811", + "Walter6041", + "Cole6086", + "Huels8350", + "Friesen6579", + "Mosciski8695", + "Schuster2212", + "Langosh7516", + "Hilll5876", + "Fadel5143", + "Lebsack9517", + "Runolfsson8332", + "Robel8055", + "Blanda7940", + "Ebert9987", + "Glover2890", + "Gottlieb5723", + "Oberbrunner6603", + "Muller6146", + "Trantow1326", + "Jast9376", + } + usedUserNames = map[string]struct{}{} + usedUserNamesLock sync.Mutex ) func init() { // 内部データをロードさせておく _ = gimei.NewName() ownerNames = lo.Shuffle(lo.Filter(ownerNames, func(name string, _ int) bool { return !lo.Contains(initOwnerNames, name) })) + for _, name := range initUserNames { + usedUserNames[name] = struct{}{} + } } func GenerateOwnerName() string { return ownerNames[int(ownerNamesIdx.Add(1))%len(ownerNames)] } -func GenerateLastName() string { return gimei.NewName().Last.Kanji() } -func GenerateFirstName() string { return gimei.NewName().First.Kanji() } -func GenerateUserName() string { return gofakeit.Username() } +func GenerateLastName() string { return gimei.NewName().Last.Kanji() } +func GenerateFirstName() string { return gimei.NewName().First.Kanji() } +func GenerateUserName() string { + usedUserNamesLock.Lock() + defer usedUserNamesLock.Unlock() + for { + s := gofakeit.Username() + if _, ok := usedUserNames[s]; ok { + continue + } + usedUserNames[s] = struct{}{} + return s + } +} func GenerateDateOfBirth() string { return gofakeit.DateRange(dateStart, dateEnd).Format("2006-01-02") } func GeneratePaymentToken() string { return gofakeit.LetterN(100) } func GenerateHexString(n int) string {