Created
July 18, 2010 05:15
-
-
Save tjulien/480154 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#! /usr/bin/python | |
import random | |
import sys | |
def main(): | |
''' generates a random sys.argv[1] x sys.argv[2] matrix. | |
useful for testing solutions to | |
http://github.com/AlgorithmsNYC/AlgorithmsNYC/tree/master/Problem_0001/ ''' | |
if len(sys.argv) is not 3: | |
print "Usage: gen_rand_matrix.py rows columns" | |
sys.exit(1) | |
for i in range(0, int(sys.argv[1])): | |
for j in range(0, int(sys.argv[2])): | |
print random.randint(0, 9), | |
if __name__ == '__main__' : main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment