Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Efficient selection mechanism?

by Lennotoecom (Pilgrim)
on Jan 14, 2014 at 19:53 UTC ( [id://1070592]=note: print w/replies, xml ) Need Help??


in reply to Efficient selection mechanism?

about regexpes,as ikegami offered,
my humble imput, turn every number into a letter from a to t
0 - 19 and match the original line upon every:
$v[$i++] = $_ for 'a'..'t'; @a = qw/2 13 3 16/; $a = join '', map {$v[$_]} @a; #generating 1 000 000 base of numbers for (0..1000000){ %rnd = (); while(keys %rnd < 4){$rnd{$v[int(rand(20))]} = undef;} push @b, join '', keys %rnd; } #doing search for (@b){ $counter++ if !/[$a]/; } print "$counter\n";
on my pc
1 000 000 base generated in 4 seconds,
search upon it done in 1 second
around ~370 000 unique numbers.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1070592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found