I want to generate the file in following format
--------------------------------------
mov t1, %r1
mov t2, %g1
mov t3, %o1
.
.
.
.
m times
add %r1, %g1, %o1
add %r2, %g2, %o2
.
.
.
n times
-------------------------------------------
here t1, t2, t3. .. .. etc. random numbers generated between 0 and 32 bit largest number. and %r1 in mov can be %r1-%r32, %g1-%g7, %o0-%o7, %i0-%i7, %l0-%l7 which can also be generated randomely but all should be different in every line . Same case is for all lines begining with add.
will it be possible with perl script??
Also since %r1-%r32 .. etc are limited and are different for all lines the value of m and n will be less than 30.
is %r1 a seperate value
and %r32 a different value
basically both of them being random numbers
and should the random numbers generated as this to be subtracted and displayed ?
hi it is not %r1-%r32, I mean to say %r1, %r2, %r3 ..... %r32. So I just wanted to generate for ex. mov t %r2 where t will be 32 bit random no. and %r2 is string which I also want to generate it randomely.
Sorry for confusion
ok if this is not possible atleast you can help me with perl script to generate following file
--------------------------------
mov t1
mov t2
mov t3
...
..
..
.
mov tn
where t1, t2, t3, .... tn are pseudo random numbers whose value ranges from 0 to largest 32 bit number.
What does "largest 32 bit number" mean? 4294967296? 2147483648?
hi you can give me the script with both largest 32 signed as well as unsigned nos. . Also I want the script to be executed from file and result also dumped into a file.
Here is a script to generate random numbers between 0 and 2^31-1. You will need to modify it yourself to fully meet your needs.
#! /usr/bin/ksh
#
# Set up a bc coprocess
bc |&
print -p ibase=16
#########################################################################
#### Tigershark --- a portable and powerful RNG
#
# This is a Recusion With Carry generator. It has an output modulus
# of 32768 and a period of 9,194,221,792,641,269,759.
typeset -u Entropy ZeroEntropy
ZeroEntropy="0000000000000000000000000000000000000000"
Entropy=$ZeroEntropy
typeset -i10 X3 X2 X1 X0 Carry Sum
Period=9194221792649674751
Carry=0
Sum=0
Ttigershark=0
Stigershark=0
# Sum = (Word) the accumulator
# Carry = carry
# Ttigershark = Total calls
# Stigershark = Total times started
#
# The function is now mostly for reference. The 7 lines inside the
# the function are used in most places where the function was once called.
# This improves speed.
function tigershark
{
((Sum=15*X3 + 31111*X2 + 15*X1 + 1064*X0 + Carry ))
((Carry=Sum >> 15))
((X0=Sum & 16#7FFF ))
X3=$X2
X2=$X1
X1=$X0
((Ttigershark=Ttigershark+1))
return 0
}
#
# weak_start_tigershark --- This is used when we can't get Entropy
function weak_start_tigershark
{
typeset -i i final duration
((final=SECONDS+2))
while((SECONDS < final)) ; do
i=$RANDOM
done
((Carry=0))
((X0=$$))
((X1=RANDOM))
((X2=RANDOM))
((X3=RANDOM))
Sum=0
((Stigershark=Stigershark+1))
return 0
}
typeset -i16 hex
typeset -u -R2 dhex2
typeset -u -R4 dhex4
weak_start_tigershark
i=0
while ((i<100)) ; do
tigershark
((hex=X0))
dhex2=0000${hex#16#}
cum=$dhex2
tigershark
((hex=X0))
dhex2=0000${hex#16#}
cum=${dhex2}${cum}
tigershark
((hex=X0))
dhex4=0000${hex#16#}
cum=${dhex4}${cum}
print -p $cum
read -p result
echo $result
((i=i+1))
done
exit 0