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

5
LINES

< > BotCompany Repo | #1018846 // varyFloat - zero to one by default

JavaX fragment (include)

static float varyFloat(float x) {
  ret tossCoin()
    ? (float) random(max(x-0.1, 0), x)
    : (float) random(x, min(x+0.1, 1));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018846
Snippet name: varyFloat - zero to one by default
Eternal ID of this version: #1018846/3
Text MD5: 1400655ed02465c8da924441af438941
Author: stefan
Category: javax / random
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-14 12:58:40
Source code size: 135 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 396
Version history: 2 change(s)
Referenced in: [show references]