Showing posts with label random. Show all posts
Showing posts with label random. Show all posts

Wednesday, July 25, 2012

Random Password Generator


N := factor of 3


% N=9 ; (dd if=/dev/urandom bs=$N count=1 | uuencode -m - | sed -n '2p') 2>/dev/null
--
  = ^ . ^ =

Thursday, March 22, 2012

Delete temp files and directories

% while sleep 0.1 ; do if [ $(($RANDOM % 2)) -eq 0 ] ; then rmdir -v `mktemp -d` ; else rm -v `mktemp` ; fi ; done ; 


--
  = ^ . ^ =

Tuesday, August 9, 2011

random.c

% cat random.c
#include
#include
#include
#include

int main(int argc,char* argv[])
{
unsigned int i=0;

initstate(random(),(char*)argv,argc);

for (i=0;i
fprintf(stderr,"%d\n",random());

return EXIT_SUCCESS ;
}

% cat Makefile
CC=cc
FLAGS=-ansi -static -Wall --pedantic

random: random.c
${CC} ${FLAGS} -o random random.c

% make
% ./random 1>random.out 2>random.err
...