News for hackers. Stuff that matters.
Re:Steve Wozniak is not boring by trevmckendrick on Saturday June 07, 2014 @10:09PM (#7863755)
For the nontechnical out there:

This is a random name generator that pairs adjectives with names (e.g. "angry_einstein").

In the unlikely chance the generator returns the pair "boring_wozniak", it discards it and generates another name.

Re:Steve Wozniak is not boring by LukeB_UK on Saturday June 07, 2014 @09:38PM (#7863688)
A good example of companies and open source projects having a little humour and showing that they're human too.
Re:Steve Wozniak is not boring by gnuvince on Saturday June 07, 2014 @09:47PM (#7863713)
Can we say something about using goto?
Re:Steve Wozniak is not boring by Amezarak on Saturday June 07, 2014 @09:54PM (#7863720)
Why? To be sure they should be used sparingly, but it looks it makes enough sense in this particular case and isn't single-handedly going to cause any spaghetti-code problems.

In this particular case I think a goto fits the bill.

Re:Steve Wozniak is not boring by kyrra on Saturday June 07, 2014 @10:18PM (#7863778)
Go is fairly strict in the use of goto: http://golang.org/ref/spec#Goto_statements

They have their use cases, and this code seems like a fine use of it. Goto is taught as one of those things you should never use but it still has a purpose. If you look at any C code goto still used. You just have to make sure not to overuse it.

Re:Steve Wozniak is not boring by adamgravitis on Saturday June 07, 2014 @10:06PM (#7863748)
At least in this situation, you can see the entire affected control flow within four lines.

goto generally becomes a problem when suddenly everything is short-circuiting everywhere and you can't see where control's getting passed off to.

Re:Steve Wozniak is not boring by rgawdzik on Saturday June 07, 2014 @10:05PM (#7863745)
All tools can be misused. Goto has a dark past, but it can still be used responsibly. It's almost like generalizing a concept like OOP to be bad because horrible code can be made with it.
Re:Steve Wozniak is not boring by mholt on Saturday June 07, 2014 @10:06PM (#7863749)
Sure. This is a fair use case. Kind of makes more sense than a full while loop, especially since the case is only likely to occur at most once per call to GetRandomName().
Re:Steve Wozniak is not boring by drdeadringer on Saturday June 07, 2014 @09:56PM (#7863727)
If you use it responsibly, I don't see much problem.
Re:Steve Wozniak is not boring by pervycreeper on Saturday June 07, 2014 @09:49PM (#7863716)
or a loop that is not guaranteed to end?
Re:Steve Wozniak is not boring by klodolph on Saturday June 07, 2014 @10:05PM (#7863746)
PRNGs don't work that way. They have periods over which all possible output values are produced, close to an equal number of times. Even when producing tuples, we know that this won't loop forever.
Re:Steve Wozniak is not boring by pervycreeper on Saturday June 07, 2014 @10:42PM (#7863819)
You know that, because you already know how "rand" is implemented
Re:Steve Wozniak is not boring by yRetsyM on Saturday June 07, 2014 @09:43PM (#7863701)
Is this a reference to some earlier comment? Or just a general shout out to a hero of the programmer?
Re:Steve Wozniak is not boring by hcarvalhoalves on Saturday June 07, 2014 @09:47PM (#7863712)
Read the source - it's a random name generator that pairs adjectives + names.
Re:Steve Wozniak is not boring by kghose on Saturday June 07, 2014 @09:47PM (#7863711)
No, sometimes the generator will come up with boring_wozniac, and they just catch that case.
Re:Steve Wozniak is not boring by rmason on Saturday June 07, 2014 @09:33PM (#7863679)
Inspirational for sure but never boring.
Re:Steve Wozniak is not boring by hcarvalhoalves on Saturday June 07, 2014 @09:45PM (#7863706)
Nice touch.