|
| 07 Jul 2016 03:36 AM |
for i = 1,3 do math.randomseed(tick()) repeat math.randomseed(tick()) LPN1 = math.random(1,5) math.randomseed(tick()) print (LPN1) wait(0.1) until LPN1 == 3 end
it keep printing 2
I want try to stop when LPN1 == 3 |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 03:37 AM |
| Declare math.randomseed() at the very beginning of your script once. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 03:59 AM |
Once is enough.
-=[ RAP: 347,235 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:40 AM |
Do you even know the use of randomseed?
1) As the person said above, you pretty much only need to call it once in most cases. 2) You realise you're waiting .1 of a second right? That's a tiny amount to wait for and occasionally can cause very weird outputs with math.randomseed.
I suggest you only call it once and just keep calling math.random(1,5) until you get the desired number (which in your case is 3)
Thanks, MathematicalPie |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:46 AM |
Are all those steps even necessary? It's really simple to capture a number. math.randomseed(tick() * math.random()) -- Just to be sure. local Number = nil repeat wait() Number = math.random(1, 5) until Number == 3
-=[ RAP: 347,259 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:51 AM |
| I'm not saying that, he's already made it very convoluted and that's what I'm working around. His method is terrible, I'm just giving a solution that fits his criteria, although yours works. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:53 AM |
Oh, I wasn't saying yours was not necessary. I was on about OP's. Sorry for the confusion.
-=[ RAP: 347,257 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:55 AM |
| Oh that's fine! I apologise too! |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:56 AM |
For something his style:
math.randomseed(tick() * math.random()) for Iteration = 1, 3 do repeat wait() LPN1 = math.random(1, 5) until LPN1 == 3 -- Do stuff or break end
-=[ RAP: 347,257 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 07 Jul 2016 07:19 AM |
math.randomseed(tick()%1*1e16)
c: |
|
|
| Report Abuse |
|
|
mudkip99
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 3362 |
|
|
| 07 Jul 2016 07:23 AM |
Multiplying tick() or os.time() by math.random() doesn't really do anything. The random number generator will not have been seeded when the first math.random() is called, so you will get the same number out of it every time the game runs.
math.randomseed(tick()) or math.randomseed(os.time()) is enough in almost every situatuon, and modifying the seed any further than that really accomplishes nothing. The only way you'll get more random results is by making your own random number generator, which for most games on Roblox isn't really necessary. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 07:36 AM |
"Multiplying tick() or os.time() by math.random() doesn't really do anything. The random number generator will not have been seeded when the first math.random() is called, so you will get the same number out of it every time the game runs."
Not true. Roblox already seeds it, so it WILL be seeded before you seed it further. It's unnecessary most of the time when Roblox already does it though.
"math.randomseed(tick()) or math.randomseed(os.time()) is enough in almost every situatuon, and modifying the seed any further than that really accomplishes nothing." Neither does setting the seed the first time, you know. As I said before, Roblox already seeds it. And modifying it further DOES help with small ranges such as math.random(1, 10).
|
|
|
| Report Abuse |
|
|