chance 1.0.0+1

chance #

A minimalist generator of random numbers. Inspired by chance.js.

It currently has only basic capabilities. Feel free to contribute.

Usage #

import 'package:chance/chance.dart';

final chance = Chance();

int randomInteger = chance.integer(min: 3, max: 12); // 5

double randomDouble = chance.floating(min: 3, max: 12); // 10.9634128828224

bool randomBool = chance.boolean(likelihood: 30); // false

1.0.0+1 #

  • Fix more hints

1.0.0 #

  • Fix hints
  • Update meta data

0.9.1 #

  • Update author information

0.9.0 #

  • Move repository from Github to Gitlab
  • Minor refactoring

0.1.4 #

  • Add minMax parameter to integer and floating methods: So instead of integer(min: -value, max: value); you may now write integer(minMax: value); or integer(minMax: -value);
  • Minor refactoring

0.1.3 #

  • Fix typo in exception message
  • Minor refactoring

0.1.2 #

  • Add boolean method

0.1.1 #

  • Add some documentation
  • Add exceptions if min argument is provided without max

0.1.0 #

Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  chance: ^1.0.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:chance/chance.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/chance.dart.

Run dartfmt to format lib/chance.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and chance.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <3.0.0
Dev dependencies
test ^1.3.0