dmitry-chirkov-dremio opened a new issue, #49441: URL: https://github.com/apache/arrow/issues/49441
### Describe the enhancement requested ### Describe the enhancement requested Add `rand_integer` function to Gandiva to generate random integers, complementing the existing `rand`/`random` functions that generate random doubles. **Proposed signatures:** 1. `rand_integer()` → int32 - Returns random integer in full int32 range [INT32_MIN, INT32_MAX] 2. `rand_integer(int32 range)` → int32 - Returns random integer in range [0, range-1] 3. `rand_integer(int32 min, int32 max)` → int32 - Returns random integer in range [min, max] inclusive **Implementation approach:** - Follow the existing `RandomGeneratorHolder` pattern - Use `std::uniform_int_distribution<int32_t>` for integer generation - Validate parameters at expression compilation time (range > 0, min <= max) - Use Mersenne Twister (`std::mt19937_64`) as the random engine **Rationale:** This function provides native integer random number generation, matching common patterns in other systems and programming languages (e.g., Java's `Random.nextInt()`), and offers a more efficient alternative to `CAST(rand() * range AS INT)` for generating random integers. ### Component(s) C++, Gandiva -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
