Skip to content

Commit

Permalink
Re-use the foo variable because for some reason coffeescript is not d…
Browse files Browse the repository at this point in the history
…eclaring the x variable as locally scoped.
  • Loading branch information
bjpirt authored and majek committed Oct 30, 2012
1 parent f29fb5b commit 5964978
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils.coffee
Expand Up @@ -138,11 +138,10 @@ exports.parseCookie = (cookie_header) ->

exports.random32 = () ->
if rbytes
x = rbytes.randomBytes(4)
v = [x[0], x[1], x[2], x[3]]
foo = rbytes.randomBytes(4)
v = [foo[0], foo[1], foo[2], foo[3]]
else
foo = -> Math.floor(Math.random()*256)
v = [foo(), foo(), foo(), foo()]

x = v[0] + (v[1]*256 ) + (v[2]*256*256) + (v[3]*256*256*256)
return x
return v[0] + (v[1]*256 ) + (v[2]*256*256) + (v[3]*256*256*256)

0 comments on commit 5964978

Please sign in to comment.