A long time back, browsing through a book, I came across code for strcpy function which is part of the standard library in C:
strcpy(char *s1,char *s2)
{
while (*s1++ = *s2++)
}
Just the beauty of the code made me fall in love with C and programming all
over again. Then, I got busy with courses, jobs, projects and releases.
Recently, while programming with Ruby, I had to randomize an array of objects
before it got displayed. I thought, I should consult Google’s brain before I
whip up anything of my own. This is what I found:
(1..10).sort_by { rand }
Randomizes an array of numbers 1 to 10. Oh the beauty!
More details here if you want to learn about strcpy and here is where I spotted the Ruby code.



