Generating random integers (without repeats)

I see a lot of CL errors, which reference cellContent in “zslide#” like this one:

Following back to check1 in zanswer, that variable is a number not a boolean, so other parts are breaking. You’ll need to update it to a boolean or directly make it the string in the table instead of conditional.

As to the random number issue, can you be more specific about where that is? Which component? Which variable? There are a lot of components and screens to look at.

(Side note: It’s helpful to start a new topic. Rather than continuing in an old thread, which sometimes don’t have the same issues or solutions due to updates.)

Mr. Grubbs, thanks so much for the quick response (and thanks for all the answers you post on this forum in general…I think the vast majority of what I use in activities for my students comes from your answers). Anyway, good point on the threads, so I’ll give an update here on random numbers from a shuffled list that I was doing, then start a new thread on issues with the zslide# components.

I think I was mistaken about the random numbers working previously (I think my random numbers in the CL worked fine, but the random numbers from a shuffled list in a graph itself was stayed static and repeated across slides…just as was said a few years ago…oops). My workaround since I last posted was to use unique seed numbers for each screen. In the CL of “zgraph” (screen 6 and beyond), I used:


It requires manually updating the contents of cell (1,2) in the component “zcheck” on each and every screen, but it seems to work and allow me to use the same screen multiple times with simple changes (ideally even workable for some of my coworkers who don’t play around with this stuff on the weekends :slight_smile: ). Link to updated activity below, and thanks again for all the help!

Updated random from shuffled list

I thought the random values in a graph was fixed at some point. Regardless, the CL random generator will generate random values for each student, so you don’t need to edit the contents. The argument in randomGenerator is a seed, but not necessary. So the following will update “seed” on each button press. You can also use .int( ) instead of a float.

seed= randomGenerator(zbutton.pressCount).float(0,1) 

That would definitely make it easier to use that code and keep it in the CL. Thanks again for help!

I don’t know if this has been solved yet since I don’t want to read 6 years worth of posting. Because of this, I’ll just stick my solution in along with the presumed others.

\operatorname{shuffle}\left(\left[1…L\right]\right)\left[\left[1…a\right]+\operatorname{random}\left(\right)\left(L-a\right)\right]

… with L being the upper bound and a being the amount of integers selected.