I wrote this to test some tools, and I needed a random set of semantic versions.
This was written for macOS, using the clang C compiler. It should also work with Linux, or any other UNIX-like operating system with a fairly modern C compiler.
Note that this relies on the arc4random_uniform()
function, that
generates a pseudo-random number evenly distributed across a range.
Usage: ./rv [ -d ] [ -h ] [ -r ] <number of versions>
Arguments:
-h
This option prints the help summary.-d
This option turns on debug output to stderr.-r
This option randomizes the output, in case you need or want to test sorting the semantic versions correctly.
Note that this program assumes you have a color terminal, and uses ASCII color codes in some cases.
I also know that this could have been written in some other language, but I used C in order to easily leverage the arc4random_uniform() function, as implemented in macOS.
This is licensed under the MIT license. If you find it useful, great!
(C) Copyright 2020 Michael A. Jarvis