NCrawler Posted January 23, 2014 Share Posted January 23, 2014 Did you guys disable math.randomseed and math.random? Link to comment Share on other sites More sharing options...
RoboMat Posted January 23, 2014 Share Posted January 23, 2014 Does Kahlua have them? Why not use ZombRand() instead? Realmkeeper 1 Link to comment Share on other sites More sharing options...
NCrawler Posted January 23, 2014 Author Share Posted January 23, 2014 Does Kahlua have them?Why not use ZombRand() instead? Lol, I really should look at the internal functions before running off and finding an alternate method. I actually found a pretty robust pseudo-random number generator and converted my code to use it already. Thanks for pointing out the ZombRand function though. If you'd like to see the method that I am now using just let me know and I'll post it. In fact, it may be a good function to include in your utility functions RoboMat... Link to comment Share on other sites More sharing options...
Deadend Posted July 27, 2014 Share Posted July 27, 2014 Does Kahlua have them?Why not use ZombRand() instead? Lol, I really should look at the internal functions before running off and finding an alternate method. I actually found a pretty robust pseudo-random number generator and converted my code to use it already. Thanks for pointing out the ZombRand function though. If you'd like to see the method that I am now using just let me know and I'll post it. In fact, it may be a good function to include in your utility functions RoboMat... Sorry to revive this thread but I need to be able to generate a random number for a project. It seems to me math.random() (unless there is something I need to do with randomseed()) doesn't work with lua files for PZ mods. But that aside, how are you supposed to use ZombRand()? Is there something that needs to be imported into the lua file to be able to use that function? Link to comment Share on other sites More sharing options...
RoboMat Posted July 27, 2014 Share Posted July 27, 2014 No need to import anything. Usage is pretty straight forward: if ZombRand(10) == 0 then foo();else bar();end Deadend 1 Link to comment Share on other sites More sharing options...
NCrawler Posted July 28, 2014 Author Share Posted July 28, 2014 No need to import anything. Usage is pretty straight forward:if ZombRand(10) == 0 then foo();else bar();end Yeah, but won't ZombRand(10) return a value between 0 - 9? If I understand the previous reply he probably needs a number between 1 - xx. I'd suggest he use the function from your RMUtility library:function rnd(_value) return ZombRand(_value) + 1;endThat's what I use and it makes it so much easier than having to remember to +1 every time I need a random value. Thank you for that library, btw. I use a couple of functions in there extensively... Link to comment Share on other sites More sharing options...
RoboMat Posted July 28, 2014 Share Posted July 28, 2014 Yeah, but won't ZombRand(10) return a value between 0 - 9? Yes exactly It's just an example of how it could be used. That's what I use and it makes it so much easier than having to remember to +1 every time I need a random value. Thank you for that library, btw. I use a couple of functions in there extensively... Glad the library helped someone I really should go back and improve it though ... a lot of the stuff that's in there is from the early beginnings of my lua career Link to comment Share on other sites More sharing options...
NCrawler Posted July 28, 2014 Author Share Posted July 28, 2014 Glad the library helped someone I really should go back and improve it though ... a lot of the stuff that's in there is from the early beginnings of my lua career Yes, please do. I, for one, would use it... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now