如何生成0到1(例如0.14)之间的非整数随机数(随每次运行而变化)? 谢谢
int N=100000000; float randFloat[i in 1..10]=rand(N)/N; execute { Opl.srand(new Date().getMilliseconds()); writeln(randFloat); }
每次运行都会给出不同的值
PS:
OPL CPLEX中的4个随机函数,可以在https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?MessageKey=12f29a09-26e3-47d9-98b4-94b2c6fc4306&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer#bm12f29a09-26e3-47d9-98b4-94b2c6fc4306中读取