func init // adds using namespace sys.add_use('System') // initialize instance params = this.props('Constructor').value if(params == 'Constructor') params = '' elseif(params == 'Constructor2') params = '' + d("Seed") end sys.add_object(this.codename, 'Random', params) // initialize variables if(linked("Next") and linked("doNext")) sys.add_var('rnd', 1) end if(linked("Next2") and linked("doNext2")) sys.add_var('rnd_', 1) end // makes implementation of methods as properties sys._mtd_as_prop_init('NextDouble()') sys._mtd_as_prop_init('Random') end func doConstructor() blk.println(this.codename, ' = new Random();') end func doConstructor2(Seed) blk.println(this.codename, ' = new Random(', d("Seed"), ');') end func doNext(data) if(linked("Next")) blk.println(this.rnd, ' = ', this.make_next(data), ';') event("onNext", this.rnd) else event("onNext", this.make_next(data)) end end func doNext2(data) if(linked("Next2")) blk.println(this.rnd_, ' = ', this.make_next2(data), ';') event("onNext2", this.rnd_) else event("onNext2", this.make_next2(data)) end end func doNextBytes(buffer) blk.println(this.codename, '.NextBytes(', d("buffer"), ');') end func NextInteger return(this.codename + '.Next()') end func Next if(linked("doNext")) return(this.rnd) else return(this.make_next()) end end func Next2 if(linked("doNext2")) return(this.rnd_) else return(this.make_next2()) end end func make_next(data) return(this.codename + '.Next(' + d("Min") + ', ' + d("Max") + ')') end func make_next2(data) return(this.codename + '.Next(' + d("Max") + ')') end