randomizer-portugal-numbers
Reactive icon

Randomizer Portugal Numbers

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 2 Apr (yesterday)
 by 
0.0
 (0 ratings)
randomizer-portugal-numbers

Randomizer Portugal Numbers

Documentation
1.0.0

Randomizer Portugal Numbers - Documentation

1. Introduction

Randomizer Portugal Numbers is a specialized OutSystems library designed to generate statistically accurate and algorithmically valid synthetic data for the Portuguese context. It is an essential tool for developers and QA testers who need high-fidelity mock data that passes standard validation rules (Checksums).


2. Core Functions (Client Actions)

2.1. Government & Legal Identifiers

GetRandomNIF

Generates a valid Portuguese Tax Identification Number (NIF).

  • Algorithm: Modulo 11.

  • Prefixes: Randomly selects from common prefixes (1, 2, 5).

  • Output: Value (Text) - 9 digits.

GetRandomBI

Generates a legacy Identity Card number (BI).

  • Algorithm: Modulo 11.

  • Structure: 8 random digits + 1 check digit.

  • Output: Value (Text) - 9 digits.

GetRandomUtente

Generates a National Health Service Number (SNS).

  • Algorithm: Modulo 11.

  • Prefix: Starts with "1".

  • Output: Value (Text) - 9 digits.


2.2. Financial & Connectivity

GetRandomNIB

Generates a valid Bank Account Identifier (NIB).

  • Algorithm: Modulo 97 (ISO 7064).

  • Output: Value (Text) - 21 digits (19 random + 2 check digits).

GetRandomMobile

Generates a Portuguese Mobile Phone Number.

  • Prefixes: Randomly selects from 91, 92, 93, or 96.

  • Output: Value (Text) - 9 digits.


2.3. Personal Data

GetRandomName

Generates a realistic full name based on Portuguese naming conventions.

  • Input: IsFemale (Boolean).

  • Logic: Combines 1 first name (from a pool of 400+) with 2 or 3 surnames (from a pool of 550+).

  • Output: FullName (Text).

GetRandomDOB

Generates a random Date of Birth.

  • Inputs: MinAge (Integer), MaxAge (Integer).

  • Output: BirthDate (Date).


2.4. Custom Utility Logic

GetRandomCustomRange

Generates a random integer within a specific range.

  • Inputs: Min (Integer), Max (Integer).

  • Output: Result (Integer).

GetWeightedBoolean

Generates a True/False value based on custom probability.

  • Input: TrueProbability (Decimal) - Range 0.0 to 1.0 (e.g., 0.7 for 70%).

  • Output: Result (Boolean).


3. Technical Implementation Details

  • Architecture: All functions are implemented as Client Actions with the Function property set to Yes.

  • Engine: Logic is processed via JavaScript Nodes to ensure high-speed calculation of checksums without server round-trips.

  • BigInt Support: The NIB generator utilizes BigInt for 64-bit integer precision during Modulo 97 calculations.

  • Randomness: Uses the Math.random() PRNG (Pseudo-Random Number Generator).


4. How to Use

  1. Dependencies: Add the Randomizer Portugal Numbers producer to your consumer module.

  2. Logic: Drag the desired action (e.g., GetRandomNIF) into your logic flow.

  3. Expressions: Since they are functions, you can use them directly in Expressions or Assigns:

    • Var1 = GetRandomNIF()

    • Var2 = GetRandomName(IsFemale: True)

  4. UI Data: For "Weighted Boolean", ensure you pass a decimal (e.g., Input_Percentage / 100) to the TrueProbability input.


5. Compatibility

  • OutSystems Version: ODC (OutSystems Developer Cloud) and O11 (Reactive & Mobile).

  • Browsers: All modern evergreen browsers (Chrome, Firefox, Edge, Safari).


Developer Note

This component is intended for testing and development purposes only. While the numbers generated are algorithmically valid, they are synthetic and do not correspond to real individuals or accounts.