Random Unicode script generator
Generate random numbers from various distributions.
Random script Message
High-performance 2D spatial index for rectangles (based on R*-tree with bulk loading and bulk insertion algorithms)
TypeScript definitions for d3-random
Fastest random ID and random string generation for Node.js
A tiny script for generating attractive random colors
URL and cookie safe UIDs
Use the random function in CSS
Generate a cryptographically strong random string
Universal Module for Secure Random Generator in JavaScript
An alias package for `crypto.randomBytes` in Node.js and/or browsers
Operation with random numbers for ngraph.*
Normalize the creation of cryptographically strong random values.
Seeded random number generator for Javascript.
Random utility functions for ethers.
A Pulumi package to safely use randomness in Pulumi programs.
The Fisher-Yates (aka Knuth) shuffle for Browser and Node.js
A small implementation of `crypto.getRandomValues` for React Native. This is useful to polyfill for libraries like [uuid](https://www.npmjs.com/package/uuid) that depend on it.
Provides functions for detecting if the host environment supports the WebCrypto API
Statistical routines and probability distributions.
Generate a random integer
A library for arbitrary-precision decimal and non-decimal arithmetic
math-random is an isomorphic, drop-in replacement for `Math.random` that uses cryptographically secure random number generation, where available
Given a set of random directories, this scripts outputs the files in them in a random order. Combined with limitations by size or by number, this can be used to pick a random collection of files from the given directories.
RandomJpg is a tool for easy downloading random images for use in scripts, application test data etc. It runs silently in the background feeding random images to a named pipe at a specified location, by default /tmp/random.jpg.
Miscellaneous methods that may or may not be useful. sh:: Safely pass untrusted parameters to sh scripts. Raise an exception if the script returns a non-zero value. fork_and_check:: Run a block in a forked process and raise an exception if the process returns a non-zero value. do_and_exit, do_and_exit!:: Run a block. If the block does not run exit!, a successful exec or equivalent, run exit(1) or exit!(1) ourselves. Useful to make sure a forked block either runs a successful exec or dies. Any exceptions from the block are printed to standard error. overwrite:: Safely replace a file. Writes to a temporary file and then moves it over the old file. tempname_for:: Generates an unique temporary path based on a filename. The generated filename resides in the same directory as the original one. try_n_times:: Retries a block of code until it succeeds or a maximum number of attempts (default 10) is exceeded. Exception#to_formatted_string:: Return a string that looks like how Ruby would dump an uncaught exception. IO#best_datasync:: Try fdatasync, falling back to fsync, falling back to flush. Random#exp:: Return a random integer 0 ≤ n < 2^argument (using SecureRandom). Random#float:: Return a random float 0.0 ≤ n < argument (using SecureRandom). Random#int:: Return a random integer 0 ≤ n < argument (using SecureRandom). Password:: A small wrapper for String#crypt that does secure salt generation and easy password verification.
AFINUS is ruby gem to destroy data and clean device. This is useful if you want to sell your computer, but you want to be sure that buyer can't recover your files. This simple script can make all your files non-recoverable even for experts, but if you work with high-sensitive data, you can also fill HD with random bytes (default 512kb).
Music Coder is a music programming library. It generates music entirely through code in the chosen programming language (Ruby). There are three main reasons a technically minded person would use Music Coder: Producing music: Write scripts that mimic human creativity, and put some randomness in it, giving you a program that can generate aesthetically pleasing music that is completely unique in each file generated. Scientific exploration: Use the functions in Music Coder to concisely apply algorithms or math to the structure and properties of sound. Making samples: create samples or sections of music that are too complex to be done by hand in graphical audio programs such as Ableton.
A program to ease and automate the planning of meals. Each meal has a main dish and optionally side dishes as well. These are currently loaded from the meals.csv file in the directory of the command line script. That will be changed in a future release when they will be loaded from a database instead. A menu consists of any number of days that the user chooses. Each day can have any meal as user wishes. When the program is run, the meals are loaded at random from the meal source and presented to the user. The user then has the option to switch out any that she doesn't want on a particular day. If two meals are given, the two meals are switched between each other. If only one meal is given, that meal is switched with another from the meal source that isn't already in the menu. When the user quits the program, the current menu is stored in a menu.txt file so that it can be printed and used in shopping, preparing meals, etc. In a future release, each dish in a meal will be associated with a recipe so that a shopping list and recipe book can be created directly from the same source.
# StudioGame (Alec) Jogo de terminal em Ruby com **jogadores, dados, tesouros e variações de jogadores** (Clumsy e Berserk), empacotado como gem. > Nome do gem (exemplo): `studio_game_alec` --- ## 🚀 Instalação e execução ### Rodando direto do código-fonte No diretório do projeto: ```bash ruby bin/studio_game ``` Se você não passar um arquivo de jogadores via CLI, o script usa o `players.csv` que fica em `bin/` por padrão. Também funciona passando um CSV na linha de comando: ```bash ruby bin/studio_game my_favorite_players.csv ``` ### Como gem (local) Empacote e instale localmente: ```bash gem build studio_game.gemspec gem install studio_game_alec-<versao>.gem ``` Depois rode: ```bash studio_game ``` > No Windows, o executável será resolvido pelo RubyGems. Se preferir, rode: `ruby bin/studio_game`. --- ## 📁 Estrutura do projeto ``` games/ ├─ bin/ │ ├─ studio_game # script principal (tem shebang) │ └─ players.csv # CSV padrão (nome,vida) ├─ lib/ │ └─ studio_game/ │ ├─ auditable.rb │ ├─ berserk_player.rb │ ├─ clumsy_player.rb │ ├─ die.rb │ ├─ game.rb │ ├─ game_turn.rb │ ├─ loaded_die.rb │ ├─ playable.rb │ ├─ player.rb │ └─ treasure_trove.rb ├─ spec/ │ └─ studio_game/ # specs RSpec ├─ LICENSE ├─ README.md └─ studio_game.gemspec ``` - **Namespace:** todo o código vive dentro do módulo `StudioGame` para evitar colisões. - **bin/studio_game:** script CLI com shebang (`#!/usr/bin/env ruby`). Faz _fallback_ do `$LOAD_PATH` para `lib` quando usado fora da gem. - **lib/studio_game/**: código da biblioteca (classes/módulos). - **spec/**: testes RSpec. --- ## 🧩 Conceitos principais - **Player** (`player.rb`): representa um jogador com `name`, `health`, coleta tesouros e calcula `score` (= `health` + `points`). Inclui o mixin **Playable**. - **Playable** (`playable.rb`): mixin com `w00t`, `blam` e `strong?` (altera/consulta `health` via getters/setters). - **TreasureTrove** (`treasure_trove.rb`): define `Treasure = Struct.new(:name,:points)` e a constante `TREASURES`; possui `.random`. - **Die/LoadedDie** (`die.rb`, `loaded_die.rb`): rolam valores (o carregado favorece 1,1,2,5,6,6). Ambos incluem **Auditable**. - **Auditable** (`auditable.rb`): imprime “Rolled a X (DieClass)” após cada rolagem. - **Game** (`game.rb`): agrega jogadores, carrega CSV, executa rodadas, soma pontos e salva _high scores_. - **GameTurn** (`game_turn.rb`): executa a lógica de um turno para um jogador (rola dado, aplica `blam/w00t/skip` e concede tesouro). - **ClumsyPlayer / BerserkPlayer**: variações de `Player` que modificam comportamento de `w00t` e de coleta de tesouros. --- ## 🧪 Testes Rode todos os testes: ```bash rspec ``` Principais coisas testadas: - Ordenação de jogadores por `score` (usa `<=>` em `Player`). - Cálculo de `points` e `score` (soma de tesouros + vida). - Efeitos de `w00t`/`blam` e força (`strong?`). - Lógica de turno com _stubs_ de dado (`allow_any_instance_of(LoadedDie).to receive(:roll).and_return(n)`). - Comportamentos de `ClumsyPlayer` e `BerserkPlayer`. --- ## 📦 CSVs e caminhos - `bin/studio_game` resolve o CSV padrão assim: ```ruby default_player_file = File.join(File.dirname(__FILE__), 'players.csv') game.load_players(ARGV.shift || default_player_file) ``` - Você pode passar um arquivo `.csv` via CLI como primeiro argumento. Formato do CSV: ``` Moe,100 Larry,60 Curly,125 ``` --- ## 🧾 High Scores Após sair do loop, o jogo grava `high_score.txt` com as entradas ordenadas. Cada linha é formatada por `Game#high_score_entry`: ``` <nome com padding de pontos> <score> ``` --- ## 🛠️ Dicas de desenvolvimento - Use `require 'studio_game/arquivo'` quando a gem estiver instalada. - No script binário, o `begin/rescue LoadError` faz _fallback_ para `$LOAD_PATH` local, útil fora da gem. - Para debugar I/O em testes, o spec redireciona `STDOUT` (`$stdout = StringIO.new`). --- ## 📚 Licença MIT – veja o arquivo `LICENSE`.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.