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

3
LINES

< > BotCompany Repo | #1006087 // vary0to1

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5175L/28K).

static float vary0to1(float x, float max default 0.1f) {
  return Math.max(0f, Math.min(1f, (float) (x+random(-max, max))));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006087
Snippet name: vary0to1
Eternal ID of this version: #1006087/3
Text MD5: eb885067de1aa12a8ad9c035af971eaa
Transpilation MD5: 3ecf532fdc698209fe4a3ca1b08e9333
Author: stefan
Category: javax / genetic optimization
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-13 04:48:59
Source code size: 128 bytes / 3 lines
Pitched / IR pitched: No / No
Views / Downloads: 433 / 469
Version history: 2 change(s)
Referenced in: [show references]