generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Making things more randomized

Previous Thread :: Next Thread 
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
31 Jul 2016 10:27 PM
So I am trying to keep multiple AI ran by the same main scripts but I encountered an annoying problem.

Math.random(min,max)

It worked but it does not produce accurate results

for example:

print(math.random(20,70))
all it keeps returning is

60 60 60 60 60 60 59 59 60 59 60 each time i run it

only 2 numbers came out even though i called math.randomseed(tick()) before it

Is there a more random method?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
31 Jul 2016 10:30 PM
speed bump
Report Abuse
thebijespun is not online. thebijespun
Joined: 24 Feb 2011
Total Posts: 400
31 Jul 2016 10:32 PM
math.random(math.random(min,max),math.random(min,max))


Report Abuse
Pxkez is not online. Pxkez
Joined: 24 Sep 2015
Total Posts: 1066
31 Jul 2016 10:37 PM
local lastvalue=nil
local start =10
local End = 20

function RandomNumber(strt,fin)
local value=nil
if lastvalue~=nil then
while true do
wait()
value=math.random(strt,fin)
if value~=lastvalue then
break
end
end
elseif lastvalue==nil then
value=math.random(strt,fin)
end
lastvalue=value
return value
end


for i = 1,10 do
print(RandomNumber(start,End))
end


-- [[you may be asking yourself, " Is this skrub an idiot did he seriously just type 25 lines to find a better solution than 1 line " , and you're completely right. ]]
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
31 Jul 2016 11:21 PM
@Pxkez I could be wrong but it looks like you're making a random number generator that isn't random.
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
31 Jul 2016 11:31 PM
There is no such thing as random. But there are close enough ways.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
31 Jul 2016 11:32 PM
@Vez, wrong.
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
31 Jul 2016 11:35 PM
D:

Explain yourself porfavor.
Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
31 Jul 2016 11:35 PM
@tyn
Wrong
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Jul 2016 11:37 PM
In a universe defined by laws you're going to be hard pressed to find something truly random. I doubt even radioactive decay is random, but I mean sure anything can happen.


Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
31 Jul 2016 11:38 PM
No matter what,there is nothing that is fully random.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
31 Jul 2016 11:39 PM
random.org

"RANDOM.ORG offers true random numbers to anyone on the Internet. The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random number algorithms typically used in computer programs. "
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
31 Jul 2016 11:40 PM
There are basically 2 kinds of RNG

PRNG (what everyone generally uses)
CSPRNG (Cryptographically Secure, unpredictable, about as close to true randomness as is allowed by science)

Which may include random bit generators in their operation

DRBG
HMAC_DRBG
Dual_EC_DRBG (Never use these if you can help it)

And others that I know nothing about.
My point is unless you've got an entropy harvesting daemon with enough resources to produce reasonable randomness, just use math.random or another PRNG.

Btw never set math.randomseed multiple times, especially if you're pulling random values immediately afterwards on each occasion. Then it's very predictable.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Jul 2016 11:41 PM
It's still not truly random though. Weather isn't truly random, dice rolls aren't truly random, spinners aren't truly random, coin flips aren't truly random. It's all based on physics, which is just laws.


Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
31 Jul 2016 11:41 PM
Just because they use an algorithm that is complex doesn't mean it's truly random.Though what they offer might be better than ‘pseudo-random’ it doesn't mean they are truly random.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
31 Jul 2016 11:42 PM
What is random? Something you cannot predict, therefore, random.
But yeah, dies aren't random, mostly everything has its reason.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Jul 2016 11:44 PM
That makes sense Tynezz, but still, math.random can only really be predicted by a computer...


Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
31 Jul 2016 11:44 PM
Just because you can't predict it doesn't mean it's random.Though it might be hard to tell,they are made of only algorithms which are repeated.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
31 Jul 2016 11:44 PM
Yes, I agree
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
31 Jul 2016 11:45 PM
@arsh, so what is random?
Is it something without reason? Is it something with no purpose? Is it something that is completely unpredictable?
Report Abuse
Cuyler is not online. Cuyler
Joined: 27 Feb 2006
Total Posts: 3784
31 Jul 2016 11:48 PM
With enough computational power, everything can be analyzed and predicted. Randomness is only our own ignorance. For the most part, however, what we use for "randomness" in computers works well enough, because it's hard for a brain to predict it.

To answer the op's question, you could try doing this at the beginning of your script:
math.randomseed(tick()) --//Sets the math.random seed to the current tick.

(Studio will give you the same numbers in play solo, because it's trying to give you consistent results. Test your script in a published place over and over, and it shouldn't be the same.)


Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
31 Jul 2016 11:48 PM
CSPRNGs are designed to be better, more random, with an enormous amount of entropy both input and output. They get by all the common shortcomings of regular PRNGs. Unfortunately the key to their success is having a perfect source of randomness, which is impossible. So the bigger your machine, the more data it processes, the more programs run, etc, will increase the effectiveness of entropy harvesting.

But Roblox doesn't give us good enough randomness. That's why I made my own RNG. It's still powered by math.random but it reseeds using a sine function that calculates something to do with the difference between tick and os.time. I seem very unsure of that because I don't remember exactly how it works.
Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
31 Jul 2016 11:49 PM
unpredictability has nothing to do with it.Like already stated a human can't fully predict the outcome of a dice every time,though it not random overall,to the human it may seem so.
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
31 Jul 2016 11:49 PM
@Cuyler That right there is one of the greatest quotes I've ever heard of

"Randomness is only our own ignorance."
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Jul 2016 11:50 PM
"Randomness is only our own ignorance"
I would use "finite minds", or perhaps "finite minds allocating resources to more important things like dodging traffic yet aren't suited to figuring it out even if we weren't so ignorant".


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image