RealMillisecs request for therevills
Monkey Forums/Monkey Programming/RealMillisecs request for therevills
| ||
In this post http://www.monkeycoder.co.nz/Community/posts.php?topic=5785 therevills said.. Realmillisecs was one of the first things in Diddy, due to the lack of date functions in Monkey at the time... to create a "proper" seed. I really should change it to wrap the newish date functions to remove the external code. Have you done this yet? Or do you plan on doing it? I am interested in what this would look like without external code. I am hoping to use RealMillisecs as a seed for my random numbers without including diddy. I could just take the external code, but was hoping for something a little cleaner. Thank you! |
| ||
I don't know if it is still the same, but in my version of Diddy you just need to import diddy.externfunctions. |
| ||
Right, I went through the diddy code and the externfunctions and understand what is going on there. I just was hoping for a cleaner solution than grabbing all of that. I am not using diddy in my project. Although I think it is a great framework and I have taken a handful of things from it. |
| ||
Nope not yet, but thanks for reminding me :) As for a "cleaner" solution to generate a random seed you could do the following: Strict Import mojo Function Main:Int() New MyApp() Return True End Class MyApp Extends App Field rndNo:Int Method OnCreate:Int() Local date:Int[] = GetDate() Print date[5] + "." + date[6] Seed = date[5] + date[6] rndNo = Rnd(1000) SetUpdateRate(60) Return True End Method OnRender:Int() Cls DrawText Seed, 10, 10 DrawText rndNo, 10, 20 Return True End Method OnUpdate:Int() Return True End End |
| ||
Thank you!! Love all of your code :) |