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

9
LINES

< > BotCompany Repo | #1022933 // RandomAndVary_Int

JavaX fragment (include)

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

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: 306 / 711
Version history: 1 change(s)
Referenced in: [show references]