Tag Archive for 'random'

Random password generator

date +%s | md5 | cut -c -12

Okay, the consensus in the comments seems to be that this does not make great passwords. I’m happy with its level of randomness, but of course I agree that only numbers and lowercase letters does not provide for maximum security.

Looks like there is a password generating program called pwgen, or to generate acceptably random passwords without installing extra software:

openssl rand 9 -base64

(btw– my purpose here is to generate passwords for things like mysql accounts, so they do not need to be human-memorable)

SQL CHALLENGE

Arrrrre you readyyyyy— for an es Q elllllllll— CHALLENGE!!!!!

I have a user table, let’s say with name and zipcode. I can do the following successfully:

  1. Select a random user with SELECT * FROM users ORDER BY RAND(UNIX_TIMESTAMP()) LIMIT 1
  2. Select all users, with only 1 from each zipcode, using SELECT * FROM users GROUP BY zipcode update: I simplified this as per Danny’s suggestion below

The only problem is, in case 2, it’s always the same user per-zipcode. I want to randomize which in the grouping gets pulled out. I would prefer that the solution not involve joining the table on itself, although if I don’t find another solution I will probably whip up the self-join solution just for fun.




Close
Powered by ShareThis