方法一:
DATA:my_value TYPE i,
my_seed type i.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX = 11"随便写一个
RAN_INT_MIN = 1
IMPORTING
RAN_INT = my_seed
EXCEPTIONS
INVALID_INPUT = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
"只写一个call得到的随机数每次都是一样的,要写两次.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX = 100 "随机数范围:到
RAN_INT_MIN = 1 "随机数范围:从
IMPORTING
RAN_INT = my_value
EXCEPTION