Steve Wozniak Is Not Boring
// GetRandomName generates a random name from the list of adjectives and surnames in this package // formatted as "adjective_surname". For example "focused_turing". If retry is non-zero, a random // integer between 0 and 10 will be added to the end of the name, e.g "focused_turing3" func GetRandomName(retry int) string { begin: name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) if name == "boring_wozniak" /* Steve Wozniak is not boring */ { goto begin } if retry > 0 { name = fmt.Sprintf("%s%d", name, rand.Intn(10)) } return name }
A screenshot of Go code that generates random adjective-surname names. It specifically rejects the result "boring_wozniak" because Steve Wozniak is not boring, turning a simple validation rule into a playful compliment and programming joke. This is a screenshot of Go code that generates random adjective-surname names. It specifically rejects the result "boring_wozniak" because Steve Wozniak is not boring, turning a simple validation rule into a playful compliment and programming joke.
code editor screenshot / скриншот редактора кодаGo source code / исходный код Goprogramming function / функция программированияhighlighted code line / выделенная строка кодаcomment text / текст комментарияmonospace text / моноширинный текстwhite background / белый фонsyntax highlighting / подсветка синтаксисаline numbers / номера строкname generator / генератор имёнunderscore-separated name / имя с подчёркиванием
- @ithueti / 1017 2019-06-14
- @right_wing_dev_squads / 4031 2022-05-10
- Type
- image
- Size
- 781×301 · 34.0 KiB
- Mood
- playful, witty
- Language
- en
- Added