0.0.2 • Published 3 years ago

@solariera/scramble-number v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Scramble Number

npm npm npm bundle size

This package generates a scrambled number.

1. Usage

1-1. Installation

# npm
npm install @solariera/scramble-number
# yarn
yarn add @solariera/scramble-number

1-2. Basic Usage

import { scramble, generateSalt } from '@solariera/scramble-number';

const [salt, _salt] = generateSalt();

const scrambled = [0, 1, 2, 3, 4].map((num) => scramble(num, salt, _salt));

console.log(scrambled);
// e.g. [1219901536, 239563430, 953425272, 1286381126, 1451104176]

2. Specifications

2-1. Syntax & Parameters

scramble(value, salt, inversedSalt)

No.NameTypeRequiredDescription
1valuenumberYesOriginal Value
1saltnumberYesSalt
2inversedSaltnumberYesInversed Salt