Determine hour in other countries with generated random time I hope the title is clear. The objective is as following:


  There are 4 clocks in a hotel in London. One is showing the time for
  London. The others for New York, Tokyo and Hong Kong. 
  
  Generate a random time for the clock in London, with that result,
  determine the hour for New York(+5), Tokyo(-9) and Hong Kong(-8). Then
  show the results.


This is not homework, this is practice. Is this a good way? Or can i generate a random timespan? All input will be appreciated!

Random generator = new Random();

DateTime london = DateTime.Now;

DateTime timeInLondon = london.AddMinutes(generator.Next());

DateTime timeInNewYork = timeInLondon.AddHours(5);
DateTime timeInTokyo = timeInLondon.AddHours(-9);
DateTime timeInHongKong = timeInLondon.AddHours(-8);

Console.WriteLine("London: " +london.ToShortTimeString() +"\n" +"New York: " +timeInNewYork.ToShortTimeString() + "\n" +"Tokyo: " +timeInTokyo.ToShortTimeString() + "\n" +"Hong Kong: " +timeInHongKong.ToShortTimeString());
DateTime london = DateTime.Now;

DateTime timeInLondon = london.AddMinutes(generator.Next());


This can be rewritten as

var timeInLondon = DateTime.Now.AddMinutes(generator.Next());


You can use var on the other lines as well.

Removing the london variable makes it less likely you make mistakes like this:

Console.WriteLine("London: " +london.ToShortTimeString()...


Where you actually output DateTime.Now as it was at the start of your program, but not, as you probably wanted, the randomized timeInLondon!

Now about your random time. 

Your seconds will obviously not be random. Apart from that, you only add a positive random number, with a maximum of around 4085 years. As such, I guess that is enough to make the resulting time more or less random as far as hours and minutes are concerned. I would opt for adding seconds though. You still would add anything up to 68 years to the current time, still probably ending up with a random-enough distribution over the 24-hour clock, including seconds:

var timeInLondon = DateTime.Now.AddSeconds(generator.Next());


Finally, if you want to nitpick, it would be better to use time zone information instead of hard-coding magic numbers like 5 or -8. Time zones do not at all times have the same number of hours difference between them(*). 

You could use TimeZoneInfo.ConvertTime Method (DateTime, TimeZoneInfo, TimeZoneInfo)

Keep in mind that if you opt for that, you might need to rethink randomisation of your time, since the date comes into play to determine the time in other places. 


(*)Not all countries start and end DST on the same dates, some countries do not even use DST, and on the southern hemisphere, DST goes "the other way around". This may all be irrelevant for the locations you picked, though.