Random Set Seed To block

I'm not sure if this a bug or not but I think my experience could help someone else who may encounter the same issue in the future.

I was tinkering with the Random Set Seed To block and discovered when I was generating a random fraction, it was returning about the same value every time ~0.72
The range of values getting fed into the Random Set Seed To block were between 0 and 200. I guessed that this was too small a range to get a wide variance in my results. When I increased the input values to around 100000 (range of 0 to 2000000) I began getting more varied results.

Best Wishes and Season's Greetings!

Here's some further information.

So as you see in this image, I was inputting a set of coordinates (integer x and integer y, each with a range of 0-100). The intent of this is a 2-dimensional world, randomly generated but each "coordinate" will have it's own consistent flavor every time the location is visited.

Edit : "guessed"

Edit 2 : details and screenshots

can you describle this issue more specific?
better with some blocks and 'do it' result.

You might show the code you used Duncan ### random set seed to

Use this block to generate repeatable sequences of random numbers. You can generate the same sequence of random numbers by first calling random set seed with the same value. This is useful for testing programs that involve random values.

This is intended behavior. See the App Inventor documentation here.
misinterpreted OP's problem

That's what I was using. The "issue" was that I was feeding the RANDOM SET SEED TO block a range of values from 0-200, and I was getting about the same result every time.
I just think this is due to the values not being varied enough(?)

I'll go try that, so you can see.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

I'll work on providing more information.

Original Post updated, see above

How to use random seed as intended.

The Block is intended to set the Math blocks random number generator.

See Random seed - Wikipedia for a discussion about the theory.

The Block random set seed is used to set the seed for the randomizer in the Math blocks to always startup at same place. You'll get the same sequence of "random" selections every time you restart the app using the code on my example. To get a different start yo sequence change the seed from 2023 to any other value. :wink:

Try the example and see for yourself., you should see the identical 'random' sequence of integers :slightly_smiling_face:

1 Like

I understand how a random seed works. Please see the update to my original message.

If you want non repeatability, try Clock1.SystemTime for a seed.

1 Like