Now i'm VERY confused... Why it runs fine on LOVE and not on Lua?Robin wrote:...
Random number?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Random number?
Re: Random number?
That's not neccesarily how randomness works. Especially the part about "common sense"; common and sense and higher mathematics don't mix. There is no common sense reason to believe that random chunks of a random pattern are any more random than the random pattern itself. Trust the mathematics guys who've been posting here on that one.I'm not proposing here to possess ultimate randomness power, I simply claim that additional randomizing slightly improves pseudo-random generated pattern by breaking it apart at really random positions. You don't even have to really apply this in your programs, you will most likely never notice the pattern if you use random just like normal. But if you do, randomization helps. Random mess of small randomly torn chunks of a total pattern is better than plain total pattern. You don't need any real experiment to confirm this, a simple common sense gives you an idea that it's true. But if you want it that bad, I can write you a random.dll that has very short internal pattern since it will only use, like, 4 bits or something, and then you can perform real experiment, as a proof of concept.
I think the problem is that your seeds are too big, which is causing the system to cast them to 0. As explained by Boolsheet:Now i'm VERY confused... Why it runs fine on LOVE and not on Lua?
batatinha, the issue that your seed isn't working as expected probably comes from the fact that you're trying to give it a 43-bit long number and somwhere in the conversion process (be it Lua oder VC++) this gets turned into 0. math.randomseed calls the C function srand that expects the type unsinged int which is 32-bit on most of today's systems. Limit the number you get from gettime by doing a modulo operation on it and the conversion will work as expected.
Re: Random number?
Oh yeah? Watch. Upper strip is 2x8 pattern. Lower strip is composed of randomly placed chunks of upper srip cut to random length. You can still see the pattern chunks, but it's isn't half as bad.That's not neccesarily how randomness works. Especially the part about "common sense"; common and sense and higher mathematics don't mix. There is no common sense reason to believe that random chunks of a random pattern are any more random than the random pattern itself.
Just before you ask source, I simply drew it. It was faster that way. But I actually used randomized brush to land pixels, and I was copy-pasting top to bottom with fast inaccurate strokes. And of course you can make this same program with pseudorand function that returns you a color from lookup table rather than usning real random. It yields same behavior, just on very small scale.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Random number?
While the cycle would probably (and hopefully) be longer than RAND_MAX. It can't possibly be longer than UINT_MAX (just shy of twice INT_MAX), because there aren't enough bits of state for a longer cycle. Probably, It'll be a shorter cycle. In that case, picking a different seed may end you up in a different cycle, which is interesting.raidho36 wrote:Only that rand doesn't return ALL bits that revolve arond inside, there's a little more is going on. So pattern may be way longer than RAND_MAX, and even than INT_MAX for that matter.For the reasons above, the two lists will be the same up to a cyclic rotation.
If it's so hard to show the "pattern" effect you propose exists, it would hardly be relevant to us, because we're never going to see the pattern anyway.raidho36 wrote:How am I supposed to re-code you exactly the program I used back then, so you could see it?
My common sense tells me it's false. If you want to convince me, vrld and the other people here, you'd better show some actual results, not just make vague claims.raidho36 wrote:You don't need any real experiment to confirm this, a simple common sense gives you an idea that it's true.
Are you using Windows? I think the problem is that the Windows stdlib has a really bad PRNG.batatinha wrote:Now i'm VERY confused... Why it runs fine on LOVE and not on Lua?
Help us help you: attach a .love.
Re: Random number?
How am I supposed to re-code you exactly the program I used back then, so you could see it?[/quote]The only argument raidho36 is willing (and maybe able) to provide is "just trust me, alright?". This isn't going to work.
You don't have to re-code it exactly. But if you can't reproduce it, you have no proof.
Without any good proof.Besides, I'm not proposing here to possess ultimate randomness power, I simply claim that additional randomizing slightly improves pseudo-random generated pattern by breaking it apart at really random positions.
Yes we do. You can't rely on the "common sense" argument for a subject as complex as randomization.You don't need any real experiment to confirm this, a simple common sense gives you an idea that it's true.
Ok, so ,why?It's not any more random, I just used the wrong term (and already acknowledged it). I mean that it makes noticeable patterns less likely.why math.randomseed(math.random()) is more random?
Re: Random number?
The top pattern isn't random. This is not a valid example of what you were claiming. You said that random chunks from random input are more random. That means you need to start with a random list at the top, and then show random sections of it at the bottom and show how those are more random. Obviously random chunks from an easily visible pattern are more random than said easily visible pattern, but that's not being claimed.raidho36 wrote:Oh yeah? Watch. Upper strip is 2x8 pattern. Lower strip is composed of randomly placed chunks of upper srip cut to random length. You can still see the pattern chunks, but it's isn't half as bad.That's not neccesarily how randomness works. Especially the part about "common sense"; common and sense and higher mathematics don't mix. There is no common sense reason to believe that random chunks of a random pattern are any more random than the random pattern itself.
Just before you ask source, I simply drew it. It was faster that way. But I actually used randomized brush to land pixels, and I was copy-pasting top to bottom with fast inaccurate strokes. And of course you can make this same program with pseudorand function that returns you a color from lookup table rather than usning real random. It yields same behavior, just on very small scale.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Random number?
Well this is going everywhere!
Locked
Locked
Who is online
Users browsing this forum: No registered users and 13 guests