수학 함수 math-functions

수학 함수는 여정 표현식 내에서 수치 계산에 필수적인 수학 연산을 제공합니다. 이러한 함수를 사용하면 데이터에 대해 정확한 숫자 계산 및 변환을 수행할 수 있습니다.

다음과 같은 작업을 수행할 때 수학 함수를 사용합니다.

  • 테스트, 샘플링 또는 임의화를 위한 임의 값 생성(random)
  • 깔끔한 데이터 표시를 위해 소수점 숫자를 가장 가까운 정수로 반올림합니다(round).
  • 숫자 필드에 수학 계산 수행
  • 비즈니스 논리 및 의사 결정에 대한 숫자 값 변환

수학 함수는 십진수 및 정수 유형을 모두 처리하며, 여정 표현식에서 정확한 결과를 보장하기 위해 유형 변환을 자동으로 관리합니다.

random random

0과 1 사이의 난수를 생성합니다.

구문
random()
서명 및 반환된 유형

random()

십진수를 반환합니다.

round round

인수에 가장 가까운 정수 값을 반환하며, 인수는 양의 무한대로 반올림됩니다.

구문
round(<parameters>)
매개변수
  • decimal
  • 정수
서명 및 반환된 유형

round(<decimal>)

round(<integer>)

정수를 반환합니다.

예시

round(3.14)

3을 반환합니다.

round(3.54)

4를 반환합니다.

round(-3.14)

-3을 반환합니다.

round(3)

3을 반환합니다.

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This page documents the two math functions available in AJO journey expressions — random for generating a random decimal between 0 and 1, and round for rounding a decimal or integer to the nearest integer.

Intents:

  • Generate a random decimal value between 0 and 1 for sampling or randomization logic using random
  • Round a decimal number to the nearest integer using round
  • Apply rounding in business logic where whole numbers are required from decimal calculations

Glossary:

  • random: A function that returns a pseudo-random decimal value from 0 (inclusive) to 1 (exclusive) (product-specific)
  • round: A function that returns the closest integer to the input, with half-values rounding toward positive infinity

Guardrails:

  • random() takes no parameters
  • round accepts decimal or integer input and always returns an integer
  • Ties in round are resolved by rounding toward positive infinity (e.g., 3.5 rounds to 4, -3.5 rounds to -3)

Terminology:

  • Canonical name: Math functions — Acronym: none — variants: mathematical functions, numeric functions
  • Synonyms: “round” = “round to nearest integer”
  • Do not confuse: “round” (rounds to the nearest integer) ≠ conversion functions like toInteger (truncates the decimal part without rounding)

FAQ:

  • Q: What does random() return? — It returns a random decimal number between 0 and 1.
  • Q: How does round handle negative numbers? — It rounds toward positive infinity, so round(-3.14) returns -3 and round(-3.54) returns -3 as well (closest integer toward positive infinity).
  • Q: What is the difference between round and toInteger? — round rounds to the nearest integer (3.7 becomes 4), while toInteger truncates the decimal part without rounding (3.7 becomes 3).
  • Q: Does random take any parameters? — No, random() requires no parameters and always returns a decimal between 0 and 1.
recommendation-more-help
journey-optimizer-help