I was late in noticing the email. I'm sorry. > I still feel we should find a better name for them.
This is based on Java's Random.nextInt(), which may indeed be confusing. How about generateInt()? > What's the range of its return? It's not clear in the RFC. Currently, there is no way to check this, but we believe that since the RNG implementation is now class-based, there is no need to check this anymore. The size of the RNG to be generated is clear at the time of implementation, and implementing a way to check this would override the method and break consistency. Regards, Go Kudo 2021年7月3日(土) 4:15 CHU Zhaowei <m...@jhdxr.com>: > >> "Why does this method exist at all? When would you use it instead of > >> getInt()?" > >> > > The case for this would be if you want to get a raw unrounded random > number sequence as a number. The situations where this is required would > certainly be limited, but it would be nice to have. (At least, I know of > several production codes that use the result of mt_rand() with no > arguments.) > > These two methods confused me at first as well, but I think it's ok with > me after I check the documentation of mt_rand(), which also supports > calling without range. So, compatibility is one of the reasons why this > method exists, although I still feel we should find a better name for them. > They are too similar now, you won't be able to tell the difference without > looking into the documentation or source code. > > Besides the name issue, I have another question for nextInt(). What's the > range of its return? It's not clear in the RFC. The range of mt_rand() > (without min and max) is 0 to mt_getrandmax(), so how about nextInt()? is > there any equivalent method/constant for it? > > Regards, > CHU Zhaowei > > > >