I had a need to have a function that does the same as monadic ?, but with the
difference that the resulting numbers not be integers, but floating point.
Now, here's my attempt at creating such a function, I'd like to know if this is
the best way to achieve what I need:
∇ r←*hrRand* V ;res
⍝⍝ Like monadic ?, but returns floating point numbers
res ← ⎕SYL[19+⎕IO;1+⎕IO]
r ← V × res÷⍨ ?res+V×0
∇
Example:
* hrRand 3 2 ⍴ 10 100 5 (3 4 (2 2⍴5)) 1000*
┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
↓ 4.138685128 54.55782413 ┃
┃ 0.4543486424 ┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃
┃ ┃2.024528001 2.772781338 ┏→━━━━━━━━━━━━━━━━━━━━━━┓┃┃
┃ ┃ ↓3.185551114 3.13571477 ┃┃┃
┃ ┃ ┃1.204617876 4.396324338┃┃┃
┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━┛┃┃
┃ ┗∊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛┃
┃634.0902523 9.353801479┃
┗∊∊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Regards,
Elias