1.0.24 • Published 2 years ago

@dream-bit/math-utils v1.0.24

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
2 years ago

NPM

Some helper utilities used when working with math or random numbers.

🎓 Install

Just use npm install, yarn add or pnpm install, it's your choice. The package name is: @dream-bit/math-utils

🎉 Usage

You will find all necessary information about the functions in their own documentation. Docs: https://dream-bit-de.github.io/dream-bit-utils/packages/math-utils/docs/

Short explanation:

  • additionWithLimit(limit: number, a: number | number[], b?: number): number: Will sum up 2 numbers with a given limit. If that limit would've been exceeded by the addition, the limit is returned.
  • getRandom(): number: Note that as numbers in JavaScript are IEEE 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for Math.random() itself) aren't exact.
  • getRandomArbitrary(min: number, max: number): number: This example returns a random number between the specified values.
  • getRandomIntInclusive(min: number, max: number): number: This example returns a random integer between the specified values.
  • subtractionWithLimit(limit: number, a: number, b: number): number: Will subtract 2 numbers with a given limit. If that limit would've been undershot by the subtraction, the limit is returned.

⭐ contributing

You want to help us, and join the Dream-bit Community? Great! Please make sure to check out and understand what is written in the following files:

  • CODE-OF-CONDUCT.md
  • CONTRIBUTING.md

😊 About Dream-bit

At dream-bit dreams become software! We encourage people to do good things with software and bring humanity forward. You can be a part of us by contributing or joining the community at https://dream-bit.de

Develop software with your ❤️ as your 🧠.

1.0.24

2 years ago

1.0.23

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago