rand library
Random data generator for Dart.
Provides Rand, a static utility class with methods for numbers, text, names, dates, CSS colors, cryptographic tokens, and weighted samples.
Configure the global non-cryptographic RNG via Rand.useRng or Rand.seed. Cryptographic methods (Rand.password, Rand.nonce, Rand.bytes, Rand.secureCharCode) always use Random.secure and are not affected.
import 'package:rand/rand.dart';
void main() {
Rand.seed(42);
print(Rand.fullName()); // 'Emma Rodriguez'
print(Rand.password()); // 'k9#Mx!pL2@qR'
print(Rand.color()); // CssColors.coral
}
Classes
- Rand
- Random data generator. All methods are static.
Enums
- CssColors
- CSS named colors with their ARGB values.
Extensions
- CssColorsX on CssColors
- Utilities on CssColors.