컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
math.random
math.random()
설명
0을 포함하고 1을 제외하는 [0, 1)
범위에 있는 실수 유형의 의사 난수 값을 생성합니다.
반환 유형
FLOAT
코드 샘플
다음 예시에서는 난수 값이 [0, 1)
범위 내에 있는지 확인합니다.
none
if(math.random() >= 0 and math.random() < 1) = true
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-29(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-29(UTC)"],[[["\u003cp\u003e\u003ccode\u003emath.random()\u003c/code\u003e generates a pseudo-random floating-point number.\u003c/p\u003e\n"],["\u003cp\u003eThe generated value from \u003ccode\u003emath.random()\u003c/code\u003e falls within the range of 0 (inclusive) up to, but not including, 1.\u003c/p\u003e\n"],["\u003cp\u003eThis function is supported in Rules and Search environments within the context of the documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe return type of the function is \u003ccode\u003eFLOAT\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["### math.random\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n math.random()\n\n#### Description\n\nGenerates a pseudo-random value of type DOUBLE in the range of `[0, 1)`, inclusive of 0 and exclusive of 1.\n\n#### Return type\n\n`FLOAT`\n\n#### Code samples\n\nThe following example checks whether the random value is in the range `[0, 1)`.\n`none\nif(math.random() \u003e= 0 and math.random() \u003c 1) = true`"]]