Select random object

DOS autori shared this question 3 years ago
Answered

Is there a way to randomly select object?


I have 9 squares named, let's say: obj1, obj2, obj3, ..., obj9. They are part of the puzzle and I want to select them randomly. If I create a list with given objects it consists of object values but I need names. I also cannot generate some "i" and use it as obji or something like that.

I attached my applet for better explanation - when person enter correct result, one of the squares disapeare but it's always on the same position for the same task. (first task is to round number on two significant digits - always square 7, the second is to round number on two decimal places - always 8)


Any suggestions?

Comments (3)

photo
1

I did it! But if someone knows how to do this in easier way... I would appreciate if you share your idea!

photo
1

I thought this: you can create a list=shuffle[list of left down corner of squares] then the ie:square1=polygon[element[list,1],element[list,1]+(side,0),element[list,1]+(side,side),element[list,1]+(0,side)] is in a not knowed position

so you can use the condition answer1<>inputbox1 like in your first posted file

I can do a little example if you need it

saludos

photo
1

The thing I was looking for was shuffle command! Somehow I haven't found it yet :-)


Thanks!

photo
© 2021 International GeoGebra Institute