Create block representing one random number

I am making a number extraction application.
I specify a list of numbers from 1 to 100, and then I want to extract a random number.
I made a block as shown below, but it cannot be expressed.
How do I modify the block?

Can you show more blocks because I don’t see how the list is filled. The way it is shown now, you are trying to extract a number from the list before it is created.

Your variable number745_listAgain to list of numbers from 1-100.


Then,

Hope this helps.
Happy Thunking!

4 Likes

The list block is long, so I expressed it as above.
Actually I created it like this:

‘to randomNum1’ independent block is below.

1 Like

@codeswept’s response is the correct solution. Have you tried it?

1 Like

yes, I solved it! Thanks:)

I solved it!! Thanks for your favor:)

2 Likes

As @codeswept suggested, you can create the list of numbers using the component in the list drawer to create a list of sequential numbers.

The key is you can only try to retrieve any number from the list after it is being created. Now the code is there but not executed.

As an example, you need to execute the creation of the list of numbers when the screen starts and therefore you will have something like
image
This will make sure that the list is created and ready to be used in you next block of codes which could be associated with a button like this
image

Glad it worked!