Giter Site home page Giter Site logo

magnetarrocket / commandline-dice-posixifed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from idupree/commandline-dice

0.0 0.0 0.0 19 KB

'd': Command-line dice, no strong random, but more cross-platform.

License: Other

Shell 15.86% C 84.14%

commandline-dice-posixifed's Introduction

d: command-line dice

'd' rolls dice from the Linux command-line.

To use:

> d sides [[times][!]]
	`d` rolls imaginary dice.

	`d 6` prints a number from 1 to 6 inclusive.
	`d 6 10` prints ten numbers from 1 to 6 inclusive.
	`d 6 4!` prints four non-repeating numbers from 1
			to 6 inclusive.  For example,
			`d 5 5!`
			lets you choose a random order
			for five items you've lined up.
			For short:
	`d 5 !` arranges the numbers 1 to 5 in a random
			order, equivalent to `d 5 5!`.

	"sides" may be any number from 1 on up.
	"times" can't be negative, and if you want non-repeating.
			numbers then must be no greater than sides.

If you put it on your PATH, you can just type 'd 6' anywhere to roll a d6, or 'd 20' or even 'd 42'.

To build:

If you don't have GLib development libraries, then install them. Then

gcc -O2 -Wall -std=c99 *.c `pkg-config --cflags --libs glib-2.0` -o d

To test:

./test

If things are horribly wrong it will tell you. Also, you can look at all the output and see if it looks reasonable.

To be paranoid:

This uses Linux's /dev/urandom and an algorithm that should produce uniformly distributed numbers that are as cryptographically strong as /dev/urandom (which is: very, unless the system is in a low entropy situation like a router that just booted up and had no entropy-file stored, but human Linux users are quite fine).

However I didn't triple-check, so please tell me if I'm wrong!

commandline-dice-posixifed's People

Contributors

idupree avatar magnetarrocket 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.