DISTRIBUTE

DISTRIBUTE(value, array)[source]

Distributes an integer value across a series of buckets with defined capacities.

DISTRIBUTE allocates the input value to the buckets in a left-to-right manner, filling each bucket up to its specified capacity before moving to the next.

Parameters:
  • value (Operand | int) – The total value to distribute. Can be an integer constant or a model object of type INTEGER.

  • array (Operand) – The bucket capacities. Must be an integer array where each element represents a bucket’s maximum capacity.

Return type:

Formula

Returns:

A formula object evaluating to an integer array where each element indicates the portion of value allocated to the corresponding bucket. The array length matches the input bucket array length.

Raises:

Examples

Basic full distribution:

DISTRIBUTE(10, [5, 3, 2])
# Returns [5, 3, 2]
# Explanation:
# 5 goes to first bucket (capacity 5)
# 3 goes to second bucket (capacity 3)
# 2 goes to third bucket (capacity 2)

Partial filling:

DISTRIBUTE(7, [5, 3, 2])
# Returns [5, 2, 0]
# Explanation:
# 5 goes to first bucket
# 2 goes to second bucket (capacity 3, only 2 remaining)
# third bucket remains empty

``value`` — accepted types

  • INTEGER

``array`` — accepted types

  • INTEGER_ARRAY

Return types

  • INTEGER_ARRAY