Lua乘法。始终以相同的操作开始

时间:2018-05-23 21:38:20

标签: lua

为什么它始终以相同的操作开始?

function next_number()
 local a = math.random(1,9)
    local b = math.random(1,9)
    local result = tostring(a) .."*".. tostring(b)
    rightValue = a*b
    multiplication = result
end

1 个答案:

答案 0 :(得分:2)

您需要为随机数生成器播种。

在程序开始时拨打 public class Test { public static void main(String[] args) { ApplicationContext ap=new ClassPathXmlApplicationContext("resources/Spring.xml"); Car c=(Car)ap.getBean("c1"); c.printData(); } } 一次。