Re: [R] Help creating the IBM Randu function

2017-08-15 Thread Martin Maechler
> Richard M Heiberger > on Mon, 14 Aug 2017 14:36:40 -0400 writes: > Please look at ?datasets::randu > for David Donoho's translation of RANDU into R. Thanks a lot, Rich, for pointing to this: Indeed, the RANDU aka 'randu' data set has been part of R

Re: [R] Help creating the IBM Randu function

2017-08-14 Thread Duncan Murdoch
On 14/08/2017 2:18 PM, Huzefa Khalil wrote: Hi Martin, The corrected function would be RANDU <- function(num) { return ((65539*num)%%(2^31)) } You forgot the brackets for the return function. Hence, what was returned was always (65539 * num) Yes, this is one disadvantage of having a return

Re: [R] Help creating the IBM Randu function

2017-08-14 Thread Richard M. Heiberger
Please look at ?datasets::randu for David Donoho's translation of RANDU into R. On Mon, Aug 14, 2017 at 12:49 PM, Martin Møller Skarbiniks Pedersen wrote: > Dear all, > > I am trying to learn functions in R and 3D plotting so I decided to try > to plot > the famous bad

Re: [R] Help creating the IBM Randu function

2017-08-14 Thread Huzefa Khalil
Hi Martin, The corrected function would be RANDU <- function(num) { return ((65539*num)%%(2^31)) } You forgot the brackets for the return function. Hence, what was returned was always (65539 * num) On Mon, Aug 14, 2017 at 12:49 PM, Martin Møller Skarbiniks Pedersen

[R] Help creating the IBM Randu function

2017-08-14 Thread Martin Møller Skarbiniks Pedersen
Dear all, I am trying to learn functions in R and 3D plotting so I decided to try to plot the famous bad PRNG Randu from IBM(1). However something is not correct in the function I have created. First I define the function RANDU like this: > RANDU <- function(num) { return