Discuss Scratch

kittenslikefood
Scratcher
100+ posts

How do you pick a random item from a list, and put it into the first spot of a new list?

Thanks
han614698
Scratcher
1000+ posts

How do you pick a random item from a list, and put it into the first spot of a new list?


<Scratch Wikian | Forum Helper | 6000+ Posts>

Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why




Just_Iakov
Scratcher
100+ posts

How do you pick a random item from a list, and put it into the first spot of a new list?

han614698 wrote:


The idea overall is correct, however that would just add in a new line at the bottom of the list, not to the first spot of the list.

To add it to the very top of the list, you'll need to use the insert block

insert (item (pick random (1) to (length of [old list] :: list)) of [old list] :: list) at (1 v) of [new list]

I hope this helps,

Last edited by Just_Iakov (Sept. 30, 2021 02:20:49)

sharkode
Scratcher
1000+ posts

How do you pick a random item from a list, and put it into the first spot of a new list?

han614698 wrote:

Why don't you just use the blocks feature instead?

>>>This suggestion could end reduce mass reporting.<<<
=======================================================================================
Common forum languages (highlight this text and click shift+down arrow for more):
  • Support - Means someone supports a suggestion, make sure to say the reason when you are supporting a suggestion.
  • No support - Means someone don't support a suggestion, while it may sound a little mean, it's actually not as not everybody have to support the suggestion you purposed.
  • Bump - Bumping is a method of bringing a topic back to the front page.
  • Necroposting - Means bringing an old, dead, topic that nobody cares about back to life, necroposting comes from the greek word “nekros” meaning “corpse”, necroposting is prohibited as it wastes front page space.
  • Ocular - A website that allows you to search forum posts.
  • Dupe/duplicate - Posts that suggests the same thing, it's a good idea to use Ocular.
  • ST - Is short for Scratch Team, the moderators on this site.
  • ToS - Is short for Terms of Use, a bunch of legal jargon and stuffs like that.
  • TOLoRS - Is short for The Official List of Rejected Suggestions, it's always a good idea to read it before making a suggestion.
  • Kaj - A user who threatened to hack Scratch, he later became a legend and people often joked about him hacking posts.

Powered by DjangoBB