I’ve a question on Random class constructors. There are two constructors, one with a seed parameter and one without a seed.
What are the use cases to use Random class without a seed (parameterless constructor)? I cannot think any circumstance…
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.
If you use the constructor with the seed, using the same seed value each time will result in the same number sequence being generated each time. This is useful for testing expected scenarios.
You can test using the default constructor (it will use a time-based seed) to test for intermittent scenarios.