| Blockland Forums > Modification Help |
| getRandom returning different results on mac and pc |
| << < (4/11) > >> |
| Port:
--- Quote from: Daenth on May 19, 2012, 12:54:02 PM ---That's exactly what I pointed out up there: --- End quote --- --- Quote from: Port on May 19, 2012, 11:04:40 AM ---what --- End quote --- He is talking about utilizing setRandomSeed and then calling getRandom to return the same sequence of random numbers based on the seed, however, as I already explained, other scripts and even the engine itself are using the function as well, thus causing it to appear to "skip ahead" in the sequence (very basic explanation). |
| Daenth:
--- Quote from: Port on May 19, 2012, 01:10:50 PM ---He is talking about utilizing setRandomSeed and then calling getRandom to return the same sequence of random numbers based on the seed, however, as I already explained, other scripts and even the engine itself are using the function as well, thus causing it to appear to "skip ahead" in the sequence (very basic explanation). --- End quote --- I realize that and Ipquarx pointed out what was wrong. zmaster was saying that the getRandom function didn't have an argument for a seed and that's what I pointed it. I had no idea there was a setRandomSeed. |
| Port:
--- Quote from: zmaster on May 19, 2012, 10:38:24 AM ---What do you mean by different results? btw: double = getRandom(min,max); --- End quote --- On another note, it doesn't return a double-precision float. It always returns a string, syntaxically fixed to a integer or float with precision 6. |
| Ipquarx:
The problem here is that inside a function, there is say, the following code: --- Code: ---function blah() { setRandomSeed(1231410857510857584752610452674907490747475251113186867577116104117842712211751241120756767676774877366); for(%a = 0; %a < 50; %a++) { echo(getRandom(0, 100)); } } --- End code --- Try that on mac and pc, it will return different results. Why? How can I fix that? |
| Port:
You can't fix that. |
| Navigation |
| Message Index |
| Next page |
| Previous page |