设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7551|回复: 4

[求助] 请问如何使用代码实现随机数种子的设置?

[复制链接]
发表于 2008-12-11 23:28:08 | 显示全部楼层 |阅读模式
5仿真币
我的license不支持experiment manager对象。。。9 D" K5 y* i( h* b1 W% L* G
( y7 C$ n* M- ~9 d+ s; [* g
所以请问使用代码可以实现吗?就比如像c++或者java里面,取当前时间作为种子,填入stream中?; M1 ]' t& x$ w' w

( E2 v3 L) R" B, G8 y5 m如何写?用到哪些方法?和属性?# H+ S$ |) K9 D0 L" G7 S
+ i0 Q) q" W' N- `3 V
谢谢了

最佳答案

查看完整内容

用到这个.Stream := ; 如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样: singleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
发表于 2008-12-11 23:28:09 | 显示全部楼层
用到这个<attribute_path>.Stream := <integer>;
2 i3 {2 G9 \4 E7 a如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样:
* |0 v/ m  R) V# YsingleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
 楼主| 发表于 2008-12-12 14:02:55 | 显示全部楼层
对了,系统时间如何获得啊?
 楼主| 发表于 2008-12-14 15:56:21 | 显示全部楼层
time_to_num()这个函数不存在,只存在这些函数:, e, M4 [' M- H4 f0 v. |+ r) l
Conversion Method  Data Type of the Return Value + f3 e8 a4 P/ p1 l6 R4 ?8 a
bool_to_num(<boolean>) real
/ Z) n; {  p0 S$ U) i: Rnum_to_bool(<integer>) boolean ' n/ G% c- s0 Z, S' u; R
str_to_bool(<string>) boolean
; l: Y+ O5 I  w9 {3 [* A4 Tstr_to_date(<string>) time 2 X( d3 k: X: r7 z
str_to_datetime(<string>) datetime
8 R( Q3 `. `, C$ |9 s" Y! Bstr_to_length(<string>) length
' ?' p* X: b6 @& T# Dstr_to_num(<string>) real
, l# P6 W# p; Q8 X. `/ v, T# wstr_to_obj(<string>) object / u& \  C, u3 s- I% ~& G, }
str_to_speed(<string>) speed
! H( n+ t* v! u3 h$ ~. n1 gstr_to_time(<string>) time
; W9 ^' I% |( `+ ?# Q- j5 Fstr_to_weight(<string>) weight
& R9 q/ v9 M# o& ~to_str(<any>, ...) string 4 c1 P' o/ a' W3 ^
我的是7.0版,不知道8.1有没有。
 楼主| 发表于 2008-12-14 16:17:52 | 显示全部楼层
我的解决办法:
0 d( H3 v2 r; x, r4 Z  v* osingleProc.proctime.Stream :=str_to_num(to_str( timeOfDay(sysDate)*100000));
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-6-15 12:05 , Processed in 0.013063 second(s), 13 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表