I'm trying to generate positive random integers between 2 values and the MSDN lists this formula as generating random numbers between a certain range:
randomValue = CInt(Math.Floor((upperbound - lowerbound + 1) * Rnd())) + lowerbound
.
The page later lists an example that appears to use Int() intstead of Math.Floor():
Dim value As Integer = CInt(Int((6 * Rnd()) + 1))
.
Is there any difference between the Int method and Math.Floor in this situation?
Int() is the legacy function that existed in VB before .NET came around.
Source is not included in the Reference Source, but a decent decompiler can show you what it does. Navigate to the Microsoft.VisualBasic.Conversion class to see:
public static double Int(double Number)
{
return Math.Floor(Number);
}
No surprises, use what ever flavor you prefer.