bchavez / bchavez/Bogus

Decimal with X number of digits after decimal

Open
#332 2 comments 4 reactions 0 assignees View on GitHub
enhancement future
Dominant language
C#
Stars
9.7k
Forks
538
PR merge metrics
No merged PRs in 30d

Description

### Please describe why you are requesting a feature
I'm not sure if this is already provided but I couldn't find it. Is there a way to get a random decimal and specify the number of digits after the decimal? I can use the `Finance.Amount` option but amount seems weird to me.

### Please answer any or all of the questions below

* Is the feature something that currently cannot be done?
It can but through a method name that makes the code read awkwardly. For example:

`RuleFor(account=> account.InterestRate, f => f.Finance.Amount(min: 1, max: 5, decimals: 3));` I can wrap the method myself but was wondering if it makes sense to do that within Bogus.

* What alternatives have you considered?

`Finance.Amount`

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing Finance.Amount API and its surrounding documentation or tests. Determine whether a clearer decimal-generation entry point should support a configurable number of digits after the decimal, and consider the provided InterestRate example done when that use case reads naturally and is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.