Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialStanley Musomari
2,525 Pointsnew randomGenerator
Random randomGenerator; random. randomGenerator = new randomGenerator();
Hie guys where am i getting my code wrong here. Iam trying to initialize a new random generator
1 Answer
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou are close. the syntax for declaring is Type varName; to initialize it is varName = new Type(); to do it in one line would be Type varName = new Type(); Random is your type and randomGenerator is your varName.
Stanley Musomari
2,525 PointsStanley Musomari
2,525 PointsThis is my question
initialize a new Random variable called randomGenerator. Hint: Don't forget to use the new keyword.
This is my answer
Random randomGenerator = new Random();
i still cant get it correct