**Answer** by KumarS
·
Oct 01, 2008 at 05:41 PM

[math.rand] function will generate random number for you.

I have a question about iTest command expr. Seem like it only takes integer as arg (but expr in tcl can work with float or double)

And how I can do math for big number (more than 10 digits) or float number?

expr command can take any numeric value in iTest. I just tried: puts [expr 5.22 * 10e+100] and that produced: 5.22E101

But if I pass variable to expr, I got error message: such as

set randSeed [math.int [expr [math.rand] * 1000000]]

set time [info time]

set num [expr ${randSeed} % ($time * 1000)] ==> unable to evaluate because of non-integer argument

Can you try
math.int in $time*1000 ? That may be represented as double internally.

Copyright 2008- Spirent Communications, all rights reserved. Terms and Conditions.

- Anonymous
- Sign in
- Create
- Ask a question
- Post an idea
- Spaces
- Products Community
- Site Help
- Explore
- Topics
- Questions
- Users
- Badges