npub1rg…sc7mc on Nostr: Tried to add random enemy placement to the dungeon, but they all appear in the same ...
Tried to add random enemy placement to the dungeon, but they all appear in the same room. I realize that the common way to do RNG in C and C++, srand(time(NULL)) uses time (in seconds) as a seed, and since the loop obviously runs multiple times per second, I'm getting the same results.
I think my solution would be to use my own RNG algorithm with a seed that increments every time it is called.
{
"id":"dc37616eca5f52dd095af8792d40ca3ff2793c9e912b45b2bb71c93080938381",
"pubkey":"1a3612d7fbcd29ffe08be75e00445b7b5dff1a03d8a3b33213be2c36c08e6a18",
"created_at":1706634428,
"kind":1,
"tags": [
[
"e",
"2119666b8b18d7546becf9d792db7db4bd88e36484d6acc32ff572865d331d45",
"wss://relay.mostr.pub",
"reply"
],
[
"t",
"gamedev"
],
[
"t",
"sfml"
],
[
"content-warning",
"gamedev"
],
[
"proxy",
"https://gameliberty.club/users/xianc78/statuses/111845993917806608",
"activitypub"
]
],
"content":"Tried to add random enemy placement to the dungeon, but they all appear in the same room. I realize that the common way to do RNG in C and C++, srand(time(NULL)) uses time (in seconds) as a seed, and since the loop obviously runs multiple times per second, I'm getting the same results.\n\nI think my solution would be to use my own RNG algorithm with a seed that increments every time it is called.\n\n#gamedev #SFML\n\nhttps://media.gameliberty.club/media/media_attachments/files/111/845/992/677/469/708/original/c0829158db8c4f3d.mp4",
"sig":"1d0f33be9d3d4eb4ed4d0bb0cc8ca988d9f31ef530180aedc5ab3662b02265850d2eeb9c7bfc22d50c03e923d9c591248c6383adeeaf64b90dfc613da19b7bb1"
}