I would like to use newId to generate random numbers. Usually you would use it just once, but I might be generating up to 10 random numbers per newId.
Is it random enough?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on how you extract the numbers from the newid. You cannot treat it as 128 independently random bits.
For example if you use the first 8 bits for generating one random number between 0 and 255, use the next 8 bits to generate another number, etc. then you will see that your numbers will not be uniformly random.
v E058D654-35A8-47F2-AE40-1C4EEBBDC549 01461481-ED8D-4B85-90FA-C08621D98DAE AE861E4E-3469-4BDB-A38B-0031DACC8DAE AF8905D0-E41B-4300-94F2-33BB45698CD1 003308A6-AE0A-4E20-9F24-047A6955E748 76F9B7ED-79AB-4EB1-B361-8C0AF5177CE3 B8F1CAC0-591D-436B-BB21-FAAD9EECA983 7FBEAEFD-2163-4315-A783-8106909E47D8 85E2FC60-E7B3-400F-B20A-CEFBECAEE4F9 17ED0A03-ADAD-4521-97EE-04815A867B32 ^ | always 4You should also try to avoid reusing the same bits to generate different random numbers as your numbers will become related. If in doubt, don’t reuse the same number.
Note that there is also a
RANDfunction which you can call. This returns numbers from a uniform distribution.