Scilab
Posts  1 - 2  of  2
amg09
Hi,

I am in a biocalculus course where we use scilab and I am having trouble with an assignment. I am not looking for the answer, because I need to find it myself, but any help would be much appreciated.

Here is the question:

"Seeding the rand function in scilab with the seed 121. Our drunk starts at 2 in Figure 5. We use the HeadsTails formula given in the lesson to decide which way to move the drunk. Flip it twice, and move the drunk two steps. What is the number on the location the drunk stands on now?"


So, here is where I am so far:

rand('seed', 121);
HeadsTails=2*floor(2*rand())-1
HeadsTails=2*floor(2*rand())-1


I am completely stuck. Any input would be great.

-Alex
Save
Cancel
Reply
replied to:  amg09
TheBritz
Replied to:  Hi, I am in a biocalculus course where we use...
Hey Alex, here's what I did:

-->rand('seed',221)

-->HeadsTails = 2*floor(2*rand())-1
HeadsTails =

1.

-->HeadsTails = 2*floor(2*rand())-1
HeadsTails =

- 1.

You take the sum of the two output numbers (0 in my case) and add it to your initial starting point (2 in my case) and you have your answer. Hope that helps!
Save
Cancel
Reply
 
x
OK