Combination generator - javascript/python/node
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need to generate a bunch of permutations of some given inputs to create a large test sheet of possible outcomes.

I have created this google sheet for the example of inputs - tab 1 called Inputs -

as you can see we have a



value ,

increment value.

We need to take these to generate all possible outcomes. In the case of list we will iterate over each one of the values that are comma delimited. In the list type we will use only 1 at a time not multiples. Ideally the final solution you make will allow us to define these on the fly so if we add more inputs with the defined type then it will make the output that corresponds to it. I am aware that depending on the inputs and specifically the ranges/increments this will generate a LOT of rows.

what we should end up with is something like what you see on tab 2 called outputs. each row represents one possible permutation of the given inputs. Ive provided a pseudo look at what this should be to help reinforce the rules around the "types".

The bounty should be a running example in - so its easy to run and test. also lets us run some other languages in the browser easily. Ideally to test the solution we can give it a csv input file, run it and it will generate an output file. I found a working example of using to work with files in case it helps you use that platform for the demo

So the number of rows should be the amount of values in each range multiplied together?
B44ken 1 month ago
awarded to ocanal

Crowdsource coding tasks.

2 Solutions

init(fileName) reads a file, and outputs it as another file ending in _out.csv. Tests/examples are at the bottom of index.js.

Thanks for submitting. I’m testing this morning these submissions
Qdev 1 month ago
Winning solution

edit: updated broken link.


here is a python version which seems to be run faster than javascript

updated: fix the issue with writing output to csv.

Hey there I’m testing the solutions this morning. Is the python one returning the output file correctly or maybe just me missing something?
Qdev 1 month ago
@Qdev, you are right, there was a bug on writing to csv, i fixed that please check again.
ocanal 1 month ago
View Timeline