rnd
0.2.0, released 5 years ago by gskinner.com
Extension methods and helper functions for Random, plus a globally accessible instance.
What it does
It provides extension methods for Dart's Random class to easily generate bounded numbers, booleans, colors, and list items. It also exposes a globally accessible Random instance for quick random value generation across the app.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need quick, concise generation of random numbers, colors, or list items without boilerplate.
- You want a global Random instance that can be easily seeded throughout your app.
Skip it when
- You require cryptographically secure random numbers.
Strengths
- Convenient extension methods like getInt, getBool, and getItem.
- Global instance simplifies random calls across the codebase.
- Supports curve transformations for value distributions.
Weaknesses
- Relies on a global mutable instance which may complicate unit testing in some architectures.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:rnd/rnd.dart';
rnd(10); // random double between 0-10
rnd.getBool(0.8); // 80% chance to get trueAlternatives
Packages that do the same job and could replace rnd.
- fast_immutable_collections
Fast immutable lists, sets, maps, and multimaps for Dart
91Compare - markdown_description_list
Adds support for Markdown description/definition lists to the markdown package
63Compare - list_ext
Dart extension methods for Iterable and List like sum, count, chunks, and sorting.
50Compare - dartx
Collection of useful static extension methods for Dart core types.
50Compare