Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: generating random thruth-tables

by toolic (Bishop)
on Sep 24, 2008 at 14:06 UTC ( [id://713434]=note: print w/replies, xml ) Need Help??


in reply to generating random thruth-tables

Really no need for both print and sprintf when just printf will suffice. And while I'm at it, I'll just reach into my (perl) golf bag and club your code down some:
perl -e'printf"%03b %b\n",$_,rand(2)for 0..7'

Replies are listed 'Best First'.
Re^2: generating random thruth-tables
by ambrus (Abbot) on Sep 24, 2008 at 18:24 UTC

    You can chop one character off like perl -e'printf"%03b %b\n",$_,rand 2for 0..7'.

Re^2: generating random thruth-tables
by neniro (Priest) on Sep 24, 2008 at 16:11 UTC
    I really like this - it's shorter and easier to read!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found