title: I have n spaces, in each space, I can place a number 0 through m. Writing a program to output all possible results. Need help :)
body: <p>The idea is, given an n number of spaces, empty fields, or what have you, I can place in either a number from 0 to m. So if I have two spaces and just 01 , the outcome would be:
  (0 1)
  (1 0)
  (0 0)
  (1 1)</p>
  
  <p>if i had two spaces and three numbers (0 1 2) the outcome would be</p>
  
  <p>(0 1)
  (1 1)
  (0 2)
  (2 0)
  (2 2)
  (2 1)</p>
  
  <p>and so on until I got all 9 (3^2) possible outcomes.</p>
  
  <p>So i'm trying to write a program that will give me all possible outcomes if I have n spaces and can place in any number from 0 to m in any one of those spaces.</p>
  
  <p>Originally I thought to use for loops but that was quickly shotdown when I realzed I'd have to make one for every number up through n, and that it wouldn't work for cases where n is bigger.</p>
  
  <p>I had the idea to use a random number generator and generate a number from 0 to m but that won't guarantee I'll actually get all the possible outcomes.</p>
  
  <p>I am stuck :(</p>
  
  <p>Ideas?</p>
  
  <p>Any help is much appreciated :)</p>