List Glitch?

user26612 shared this question 5 months ago

I am having a very strange issue crop up when I am running a script in GeoGebra.

I am trying to create an applet that will create Parallel Line Theorem problems for students to solve.

I created two variables to determine the position of the given angle and the angle to be solved in the problem, but I wanted to ensure the script did not pick the same location for both. With two parallel lines being crossed by a single traversal, there would be eight possible positions.

I defined a list to hold the relevant positions:


So, I set my button up to do the following when clicked:SetValue(roll1,RandomElement(list))

SetValue(roll2,RandomElement(list \ {roll1}))
It seems to work most of the time, but - for some reason that I cannot determine - the script will occasionally assign both rolls the same value (even though the second roll is drawing from a list that should no longer include the first roll). 

The odd part about it is after 50 tests or more, the only time the rolls will match is if both of them are 5. I cannot figure out why this is happening. I thought it might be some artifact in the GeoGebra file I was working on, so I created one from scratch (attached) with only this code in it. I have tried defining the lists as actual objects to ensure that roll1 is not an element in the list that roll2 draws from, and yet it will still match up two 5s.

Can anyone explain what is going on here?

Comments (1)


That was a GGB bug in v578 or v577

The bug is fixed in the meantime with v579

But the effects of the bug is still included in the number-definitions and cannot be corrected automatically.

Check you have the latest GGB release (>= 579)

delete in rand1 and rand2 in the properties/sliders the values min and max

(without this correction, all random values greater than 5 receive the (wrong) value 5)


see also here

© 2020 International GeoGebra Institute