Teaching "math function" vs. "CS function" The word function has different meanings in math and computer science. For example, f(x) = rand(1) is a valid (pseudocoded) CS function, but it is not a mathematical function because it has multiple possible return values for a given argument. 

When and how is it most effective to bring the students' attention to the contrast? In teaching physics, it is a general principle that when possible a student should experience a phenomenon before being given words to describe it. (E.g., have students feel a torque before defining "torque".) (Arons, A. 1997. Teaching introductory Physics. New York, NY: Wiley). Presumably, there is a benefit to be obtained by introducing math functions, CS functions, and the contrast in a particular order and using a particular approach to active learning, but I am unaware of any published result to that effect. What ideas and data can people contribute to this question?
In mathematics a function is a constrained relation between two sets. You can illustrate that in a number of ways. The constraint implies consistence of operation and uniqueness of result. 

If you discuss relations (in math) as well as functions it may be easier to get beginning students to grok it. 

In most computing languages, a function is an operation that produces a value (and possibly side effects - horror). There is nothing in the definition of a Java function about constraint, not even that successive invocations with the same input produce the same values. A java function is a machine. Drop in 0 or more inputs, turn the crank, get some outputs. You can illustrate that by drawing a machine with an input hopper, and output spigot and a crank. 

Students who know math have a lot of problems early on with things that look like math but are not. Other questions in the "hopper" currently explore other aspects (equality, variables)