Search Results rand_between
Overview
The APPS.CCT_RANDOM_UTIL package is a utility package delivered within the Oracle E-Business Suite, classified as a UTIL (utility) API under the APPS schema. Its singular purpose is to provide deterministic, seedable pseudo-random number generation to other PL/SQL components in the EBS environment. Rather than requiring each calling module to implement its own random number logic — for example by calling DBMS_RANDOM directly — Oracle centralizes this capability in a single reusable package whose behavior can be controlled through an explicit seed value. The $Header comment identifies the source file as ccturans.pls with version 120.0, dated June 2, 2005, indicating a long-standing and stable component of the codebase that predates the 12.1.1 and 12.2.2 releases and has remained largely unchanged.
Key Procedures and Functions
The package exposes a compact interface consisting of one procedure and three functions:
Change_Seed— A procedure that accepts a new seed value and resets the internal random number sequence to a known starting state. This is the mechanism by which callers obtain reproducibility: invokingChange_Seedwith the same value produces the same sequence of subsequent random numbers.Rand— A function returning a random number. It forms the base primitive from which the other two functions are derived.Rand_Max— A function that returns a random number bounded above by the caller-supplied maximum value. It is used when the caller needs a random integer or value within the range starting from zero (or from the generator’s lower bound) up to a specified ceiling.Rand_Between— The function most commonly sought by developers, returning a random number constrained within an inclusive lower and upper bound supplied by the caller. This is the standard choice when a random value must fall inside a defined numeric interval, such as selecting a random item from an indexed range or simulating a value between two limits.
The metadata does not document explicit parameter lists beyond those implied by the package specification, so parameter names and defaults should be confirmed against the deployed specification in the target instance.
Tables Accessed
No tables are referenced by this package through APPS synonyms. It is a self-contained computational utility that operates entirely in PL/SQL memory, maintaining its seed and sequence state within the session. Consequently, it performs no DML, issues no queries, and imposes no database I/O overhead. This makes it safe to invoke in tight loops and in contexts where transactional side effects must be avoided.
Usage Notes
CCT_RANDOM_UTIL is typically invoked from other PL/SQL packages, custom concurrent programs, database triggers, or form-level logic that require predictable or reproducible randomization. The ETRM metadata records that the package is referenced by one other package, confirming its role as a shared dependency rather than a top-level application module. When reproducibility is required — for example in test data generation or in algorithms where a replayable sequence matters — callers should invoke Change_Seed before obtaining values. When true variability is desired, the seed may be left to the default session state. Because the package carries an APPS owner and UTIL classification, it is supported for direct invocation by custom code, though developers should be aware that behavior is session-scoped and that no persistence of seed values occurs across sessions or database restarts.