Be careful if you run this loop for long durations -- because of roundoff error in the multiplication, the amplitude may not remain precisely constant. For some frequencies, it may grow to overflow...