|
| 02 Jul 2016 05:35 PM |
Give me an equation where the numbers will be randomized, but have to stay below 5.
For example
2 3 4 1
or
4 2 1 3
|
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:39 PM |
while true do wait() print(math.random[1, 4]) end
Why did I bother answering this.
218,236 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:40 PM |
Um.
Set = {1,2,3,4} for i=1,#Set do v = Set[i] table.remove(Set,i) table.insert(Set,v,math.random(1,#Set+1)) end |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:40 PM |
local Number = 1 for i = 1,#Answers do local Select = Exam:FindFirstChild('Talk'..Number) Select.Text = Answers[i].Name Number = Number + 1 end
This will set, 1 2 3 4
What can I do to randomize the selection, while keep the 4 values? Example above. |
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:42 PM |
You should take your variable names out of context when posting on this forum unless you post the entire context tbh... Or it gets confusing af to read...
218,236 slices of pizza and counting |
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:44 PM |
If you modify the technique Lateral was using and insert it into your code it should work I think.
218,236 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:44 PM |
@Slow.
Corrected your arrogance.
while true do wait() print(math.random(1,4)) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jul 2016 05:45 PM |
Meant my above post to be for Sloegin lol
|
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:46 PM |
while wait() do print(math.random(1,4)) end
Let's make it three lines instead.
|
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:46 PM |
It doesn't matter whether you use parentheses or square brackets. Square brackets make it easier to read, you just have to remember to avoid using two in sequence... I wish not to get too salty but at least learn your fruit names.
218,236 slices of pizza and counting |
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:47 PM |
gg cyber :P
218,258 slices of pizza and counting |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jul 2016 05:53 PM |
@sloe You can't call functions with square brackets.
@Cyber while true do is more efficient. |
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:54 PM |
Not even math.random? :O You used to be able to with the standard libraries?! Thanks. RIP me.
218,258 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:55 PM |
math.randomseed(tick() * math.random()) while wait() do print(math.random(1, 4)) end
-=[ RAP: 336,411 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 05:55 PM |
| "It doesn't matter whether you use parentheses or square brackets." Lol. |
|
|
| Report Abuse |
|
|
SloeGin
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 322 |
|
|
| 02 Jul 2016 05:56 PM |
It doesn't... If it's a variable :'(
218,258 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2016 06:13 PM |
Not even with variables or standard libraries sloe.
Square brackets are for indexing tables, not for calling functions. |
|
|
| Report Abuse |
|
|