$urandom_range assigned to 2 variable of same type

108 views
Skip to first unread message

mssajwan

unread,
Sep 25, 2007, 11:16:19 AM9/25/07
to Advanced Verification Methodology User Group
Hello Friends,
A little doubt, need some clarification.
Within a module I have 2 variables and I assign a range to them
........
.......
int a;
int b;
a = $urandom_range(1,0);
b = $urandom_range(1,0);

....
.............

Now the question is for a particular seed will a & b always have the
same values?
(My assumption is yes,they will always be having same value for
specific seed)

Need your thoughts on it.
Thanks
Manmohan

Essam Arshed

unread,
Sep 25, 2007, 5:47:23 PM9/25/07
to avm-...@googlegroups.com
No, I don't think they will have the same value... they may have change to get same value but not necessarily
try to put the above code in a loop and see

Essam

mssajwan

unread,
Sep 25, 2007, 11:44:04 PM9/25/07
to Advanced Verification Methodology User Group
Thanks Essam,

Yes you are right. They will have randomized values.
I tried it yesterday itself.
thanks
Manmohan

On Sep 26, 2:47 am, "Essam Arshed" <essamars...@gmail.com> wrote:
> No, I don't think they will have the same value... they may have change to
> get same value but not necessarily
> try to put the above code in a loop and see
>
> Essam
>

Dr. Mala Mitra

unread,
Sep 26, 2007, 2:33:12 AM9/26/07
to avm-...@googlegroups.com
Hi Manmohan,
 
a and b will have different values. As b gets the next random number. But if u put a loop and store all the values of a or b in a file u will find u r getting  same values in all the runs. For example, if in the first run values of a are: 10001100 and b are: 1110011. In the second run also u'll get values of a as: 10001100 and those of b are: 1110011. If u delete the line
b = $urandom_range(1,0); u'll get 11011 etc. The values of a and b are combined provided u dont change the seed value.
 
Best Regards
--Mala


mssajwan <mssa...@gmail.com> wrote:

Thanks Essam,

Yes you are right. They will have randomized values.
I tried it yesterday itself.
thanks
Manmohan

On Sep 26, 2:47 am, "Essam Arshed" wrote:
> No, I don't think they will have the same value... they may have change to
> get same value but not necessarily
> try to put the above code in a loop and see
>
> Essam
>
> On 9/25/07, mssajwan wrote:
>
>
>
> > Hello Friends,
> > A little doubt, need some clarification.
> > Within a module I have 2 variables and I assign a range to them
> > ........
> > .......
> > int a;
> > int b;
> > a = $urandom_range(1,0);
> > b = $urandom_range(1,0);
>
> > ....
> > .............
>
> > Now the question is for a particular seed will a & b always have the
> > same values?
> > (My assumption is yes,they will always be having same value for
> > specific seed)
>
> > Need your thoughts on it.
> > Thanks
> > Manmohan



Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.

hitesh mishra

unread,
Sep 26, 2007, 3:06:38 AM9/26/07
to avm-...@googlegroups.com
No they both can't have the same value at  all the seeds.

Regards
Hitesh

On 9/25/07, mssajwan <mssa...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages