Re: [Rd] Strange Behavior in RNG

2024-08-17 Thread 谭显英
Hi Jiefei, I don't believe there's an issue with the RNG (Random Number Generator). The unexpected result you're seeing is due to providing a float number to the rnorm() function, which expects an integer. When you input a float, R coerces it to an integer using as.integer(). This function trun

Re: [Rd] Strange Behavior in RNG

2024-08-17 Thread Ben Bolker
You could argue that the 'n' argument should be rounded rather than truncated, but this form of coercion from float to integer is common/standard (in C, for example). In any case, it's a long standing part of R and is very unlikely to be changed ... On Sat, Aug 17, 2024, 12:11 AM Jiefei Wang wrot