title: Why is the first random number always the same on some platforms in lua?
body: <p>Consider the following lua code snippet :</p>
  
  <pre><code>local time = os.time()
  for _= 1, 10 do
      time = time + 1
      print('Seeding with ' .. time)
      math.randomseed(time)
      for i = 1, 5 do
          print('\t' .. math.random(100))
      end
  end
  </code></pre>
  
  <p>On a Linux machine, the result is, as expected, random numbers. But it seems that at least on Mac OS X, the first random number after changing the seed is always the same !</p>
  
  <p>I guess this is related to the fact that Lua relies on the C rand() function for generating random numbers, but does anybody have an explanation ?</p>
  
  <p>EDIT: here is an extract of the output of the above code on a linux machine (ie the output is as expected) :</p>
  
  <pre><code>$ lua test.lua
  Seeding with 1232472273
      69
      30
      83
      59
      84
  Seeding with 1232472274
      5
      21
      63
      91
      27
  [...]
  </code></pre>
  
  <p>On an OS X machine, the first number after "Seeding with ..." was always 66.</p>