Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_random.clas.abap
class cl_abap_random {
static STATIC_SUPER = undefined;
static INTERNAL_TYPE = 'CLAS';
static INTERNAL_NAME = 'CL_ABAP_RANDOM';
static IMPLEMENTED_INTERFACES = [];
static ATTRIBUTES = {};
static METHODS = {"CREATE": {"visibility": "U", "parameters": {"RO_RANDOM": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "CL_ABAP_RANDOM", RTTIName: "\\CLASS=CL_ABAP_RANDOM"});}, "is_optional": " ", "parm_kind": "R", "type_name": "ObjectReferenceType"}, "SEED": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
"INT": {"visibility": "U", "parameters": {"RV_INTEGER": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}}},
"INTINRANGE": {"visibility": "U", "parameters": {"RV_INTEGER": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}, "LOW": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}, "HIGH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "I", "type_name": "IntegerType"}}},
"SEED": {"visibility": "U", "parameters": {"RV_SEED": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}}}};
constructor() {
this.me = new abap.types.ABAPObject();
this.me.set(this);
this.INTERNAL_ID = abap.internalIdCounter++;
this.FRIENDS_ACCESS_INSTANCE = {
"int": this.int.bind(this),
"intinrange": this.intinrange.bind(this),
};
}
async constructor_(INPUT) {
if (super.constructor_) { await super.constructor_(INPUT); }
return this;
}
async create(INPUT) {
return cl_abap_random.create(INPUT);
}
static async create(INPUT) {
let ro_random = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_RANDOM", RTTIName: "\\CLASS=CL_ABAP_RANDOM"});
let seed = new abap.types.Integer({qualifiedName: "I"});
if (INPUT && INPUT.seed) {seed.set(INPUT.seed);}
ro_random.set(await (new abap.Classes['CL_ABAP_RANDOM']()).constructor_());
return ro_random;
}
async int() {
let rv_integer = new abap.types.Integer({qualifiedName: "I"});
rv_integer.set(Math.floor(Math.random() * 2147483647));
return rv_integer;
}
async seed() {
return cl_abap_random.seed();
}
static async seed() {
let rv_seed = new abap.types.Integer({qualifiedName: "I"});
rv_seed.set(Math.floor(Math.random() * 2147483647));
return rv_seed;
}
async intinrange(INPUT) {
let rv_integer = new abap.types.Integer({qualifiedName: "I"});
let low = INPUT?.low;
if (low?.getQualifiedName === undefined || low.getQualifiedName() !== "I") { low = undefined; }
if (low === undefined) { low = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.low); }
let high = INPUT?.high;
if (high?.getQualifiedName === undefined || high.getQualifiedName() !== "I") { high = undefined; }
if (high === undefined) { high = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.high); }
let lv_interval = new abap.types.Integer({qualifiedName: "I"});
abap.statements.assert(abap.compare.gt(high, low));
abap.statements.assert(abap.compare.ge(low, abap.IntegerFactory.get(0)));
lv_interval.set(abap.operators.add(abap.operators.minus(high,low),abap.IntegerFactory.get(1)));
rv_integer.set((abap.builtin.abs({val: (await this.int())})));
rv_integer.set(abap.operators.mod(rv_integer,lv_interval));
rv_integer.set(abap.operators.add(rv_integer,low));
return rv_integer;
}
}
abap.Classes['CL_ABAP_RANDOM'] = cl_abap_random;
export {cl_abap_random}; |