random

You are currently browsing articles tagged random.

We had a set of tickets to win at work today, and since i didn’t think it was fair that the first one to answer would win them, i rather had a raffle between the folks who responded to my mail within an hour.

But how do you draw a name from a hat in an impartial, elegant, fair and accountable way, rather than resorting to actual pen, paper and a hat? Enter Linux.


llauren@echkilon:~/tmp$ cat -> thehat
Alice
Bob

Carol
Dave
Eve
Isaac
Justin
Mallory
Oscar
Peggy
Steve
Trent
Walter
Zoe
llauren@echkilon:~/tmp$ shuf thehat | head -1
Eve
llauren@echkilon:~/tmp$ shuf thehat | head -1
Justin
llauren@echkilon:~/tmp$ shuf thehat | head -1
Walter
llauren@echkilon:~/tmp$

So there! The winner is Eve (scary!) with runners-up Justin and Walter. If we had three equal prices, the corresponding line would be shuf thehat | head -3.

I’m sure you could make the routine even more accountable by calculating a cryptographically valid hash of the result or at least signing the lottery session (since you can’t really store the evanescent value of /dev/urandom used for shuffling the hat), but i’ll leave that to a more critical use case.
Ah how i love Open source :)

Tags: , ,

A funny thing happened in my inbox a few days ago. I got a mail:

Hi Lauren, I have attached a two-page biosketch. I have to provide it to my South Carolina Senator by Tuesday of next week. I am scheduled to have a photo session with him on next Wednesday. Proof it for me and return using this email account.

Thanks,
Dad

On any normal day, i would first consider whether this is a spam/virus/phishing attempt and either scan the attached document for viruses or simply open it as html or with Google docs (you can see i use gmail? ;) ) and if it’s legit, respond with the kind notice that the mail had reached the wrong Lauren and suggest that the sender checked the email address used for the recipient.

Somehow, that day turned out not bo be a normal day though it up and until then hadn’t been a remarkable one in any way. Out of the blue, i felt compelled to do the man a service. After all, he had been through all the hassle of actually sending out a bio in a mail, even though it wasn’t for me. So i read it thoroughly and gave the bio-ee my well considered feedback, then sent them away with the words

Finally, i would like to add that i find it very unlikely your being my father, as he passed away in a mountaineering accident in 1981, but given the situation, i probably wouldn’t mind you being him.

Best regards,
~Robin Laurén, who shares a name, or an email address, confusingly similar to your daughter’s.

I could feel good about having done something good, and to mess with peoples’ minds. Not a bad mix.

I wasn’t exactly expecting a reply, recalling my adventures with the Schuck iTunes Gift Cert story, but at least i was hoping for a raised eyebrow on the other side of the Atlantic. I got both. In my mail today, i got a reply with a thank-you-note and that the story had been circulated around the department and people had been rather touched by this random act of kindness.

There’s something in it all that gives me a small sparkle of hope for the future, and a warm fuzzy feeling on the inside.

Tags: , , , , ,

Bad Behavior has blocked 648 access attempts in the last 7 days.

Bear