Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1022933 // RandomAndVary_Int

JavaX fragment (include)

sclass RandomAndVary_Int implements RandomAndVary<Int> {
  int min = 0, max = 255; // inclusive
  double varyFactor = 0.1;
  
  public Int randomInstance() { ret random(min, max+1); }
  public Int varyInstance(Int a) {
    ret clipInt(min, max, iround(a+(max-min)*varyFactor));
  }
}

Author comment

Began life as a copy of #1022932

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022933
Snippet name: RandomAndVary_Int
Eternal ID of this version: #1022933/2
Text MD5: 1ac9449c32091fac204682bf4c2138f6
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-14 23:18:50
Source code size: 291 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 304 / 709
Version history: 1 change(s)
Referenced in: [show references]