home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cse.unsw.edu.au
/
2014.06.ftp.cse.unsw.edu.au.tar
/
ftp.cse.unsw.edu.au
/
pub
/
doc
/
languages
/
perl
/
nutshell
/
ch5
/
findbit.eg
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1992-10-18
|
230 b
|
10 lines
$vector = "\000" x 256;
vec($vector,1,rand(256*8)) = 1;
undef $found;
if ($vector =~ /[^\000]/) {
for (length($`)*8..length($`)*8+7) {
$found = $_, last if vec($vector,$_,1);
}
}
print "found the random bit at $found\n";