Code Monkey home page Code Monkey logo

numgen's Introduction

About

Number generator

Introduction

This is a simple number generator, written in Python 3, that will create all possible permutations of n-elements in a string of k-elements where the digits 0 - 9 are the only elements used. The below example shows n = 2 and k = 2:

$ N=2; K=2
$ python3 numgen.py $N $K
00
01
10
11

The next axample shows n = 3 and k = 2:

$ N=3; K=2
$ python3 numgen.py $N $K
00
10
20
01
11
21
02
12
22

Since only digits 0-9 are used, then the max number of elements n is limited to 10:

$ N=11; K=1
$ python3 numgen.py $N $K
Maximum value of n is 10. Please try again.

Docker

Build image with accompanying docker file and use as follows

Build

$ docker build -t numgen .

Run

$ NUMGEN_NVAL=10; NUMGEN_KVAL=2
$ docker run -d \
             --name numgen.$(date +%m%d%y%H%M%S) \
             -v $PWD:/home/numgen \
             -it numgen ash \
             -c "time python /usr/src/numgen.py $NUMGEN_NVAL $NUMGEN_KVAL > output.$(date +%m%d%y%H%M%S).txt"

Logs

# How to view the time results
$ docker logs -f numgen.013120140955
real    0m 0.04s
user    0m 0.03s
sys     0m 0.00s

Output File

Output file will have format similar to output.013120140955.txt where the 013120140955 is the date the file was generated

numgen's People

Watchers

Raging Tiger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.