Created
March 8, 2012 11:04
-
-
Save azet/2000457 to your computer and use it in GitHub Desktop.
we have an array of 3 entries for e.g. restaurants, execute this a couple of times until it matches something, decision made.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while :; do for i in `seq 1 3`; do if ( echo -n 'bit match: '; dd if=/dev/urandom count=128 bs=1 >& /dev/null | grep -c '1' ) echo -e "\n\nyour match: $i" && break 2; done; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example:
1 = chinese
2 = sushi
3 = pizza
seq 1 3
for a bigger array size.count=
parameter will take longer, with higher randomization.bs=
parameter, if you wish to.update:
this is a sh/bash compliant version (output is not as nice though):