+Random Terrain Posted September 4, 2010 Share Posted September 4, 2010 Is this the best way to get a random number that is either -1 or 1? a = (255+(rand&1) | %00000001) Thanks. Quote Link to comment Share on other sites More sharing options...
Crazyace Posted September 4, 2010 Share Posted September 4, 2010 a = 255+(rand&2) Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 4, 2010 Author Share Posted September 4, 2010 a = 255+(rand&2) Thanks. I've been blocking out anything besides 1, 3, 7, 15, 31, and so on for months, so I automatically ignored the other numbers. I knew there had to be a better way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.