SamuelLanders / BetterRandNumGen

It's a better random number generator, ie. all digits that come out of it follow a normal distribution. Additionally this generator does not require preparation to work properly, ie. you do not call randomize() at any point. Finally it adds the ability to generate streams of random numeric digits of any length, output as a string.
Other
3 stars 0 forks source link

Creates Orphan Nodes #1

Open Kindavacant opened 3 months ago

Kindavacant commented 3 months ago

When I add this with 'var rand=BetterRandNumGen.new()' it creates an Orphan Node in the Godot Monitor. I have it in a class that defines headwear for every char and fills up the Orphan Nodes. Creating 5,000 people creates 20,000 Orphans.

Kindavacant commented 3 months ago

Okay I fixed the Orphan problem by changing in Betterrandumengen.gp from inheriting from Node to RefCounted. Only tested a little bit but happy to stick it back in my code (although it runs slowly).

SamuelLanders commented 2 months ago

Thanks for giving my code a try, and apologies that I did not check my email until now.

I am glad to hear that it is working for you. I am surprised to hear that it is running slowly. I anticipate that your code sees it as running slowly because you have a real time physics engine that is executing a call to my code that is not asynchronous and so halts code execution until done. I will recommend that if you know you will need some names generated that you pre-generate them rather than generate at the instant you want to access them. It is far better to have a small array of names on hand and call the array, noting which have been used and which have not, then to try to directly generate on the fly.

On Mon, Jul 15, 2024 at 6:06 PM Kindavacant @.***> wrote:

Okay I fixed the Orphan problem by changing in Betterrandumengen.gp from inheriting from Node to RefCounted. Only tested a little bit but happy to stick it back in my code (although it runs slowly).

— Reply to this email directly, view it on GitHub https://github.com/SamuelLanders/BetterRandNumGen/issues/1#issuecomment-2229090257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6TTBQF6ACQVXUUWX6LQ53ZMQFQTAVCNFSM6AAAAABKV4OU6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRZGA4TAMRVG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Thank you again for your assistance. Very Respectfully, Samuel Landers Information Systems Technician RPGLeagueDev 757-839-4255

Kindavacant commented 2 months ago

Made a mistake in which file I changed. It was calc_random.gp which Extends Node which has to be freed manually. RefCounted is a Reference Object type..thing that cleans up after itself when finished. All the Orphan Nodes are Objects which aren't freed and are considered memory leaks. I had so many I made accidently myself to discover this (a video about it here https://youtu.be/D6NbRCT0yEM).

As for the slowness: As a general random number generator it isn't slow at all. But generating an entire game world at once: every town is random in everything, over 5k people with 15+ random attributes among tons of other randomizations it's slow. Quite a delay hitting 'new game' but I like it that way. As far as one-shot random stuff it's unnoticeable and love it.

SamuelLanders commented 2 months ago

Well, that is good news. Thanks for letting me know, and I will take that as high praise. Good luck on your project, I would love to see it when you make further progress!

On Wed, Jul 24, 2024 at 7:35 AM Kindavacant @.***> wrote:

Made a mistake in which file I changed. It was calc_random.gp which Extends Node which has to be freed manually. RefCounted is a Reference Object type..thing that cleans up after itself when finished. All the Orphan Nodes are Objects which aren't freed and are considered memory leaks. I had so many I made accidently myself to discover this (a video about it here https://youtu.be/D6NbRCT0yEM).

As for the slowness: As a general random number generator it isn't slow at all. But generating an entire game world at once: every town is random in everything, over 5k people with 15+ random attributes among tons of other randomizations it's slow. Quite a delay hitting 'new game' but I like it that way. As far as one-shot random stuff it's unnoticeable and love it.

— Reply to this email directly, view it on GitHub https://github.com/SamuelLanders/BetterRandNumGen/issues/1#issuecomment-2247112994, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6TTBUTNKUZ4VEHARDQ3PLZN5KM3AVCNFSM6AAAAABKV4OU6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBXGEYTEOJZGQ . You are receiving this because you commented.Message ID: @.***>

-- Thank you again for your assistance. Very Respectfully, Samuel Landers Information Systems Technician RPGLeagueDev 757-839-4255