Super-charge your coding skills!

Hey there, pickRandom() is a Grasshopper function.

JavaScript has a built-in function called Math.random() that returns a random number between 0 and 1 (for example, 0.61). You can use this with other Math functions to create something like pickRandom(), like this:

function pickRandom(argument) {
  if (typeof argument === 'number') {
    return Math.floor(Math.random() * Math.floor(argument)) + 1;
  if (Array.isArray(argument)) {
    return argument[Math.floor(Math.random() * argument.length)];

The JavaScript documentation at MDN has some great information on what you can use and how to use it. Take a look at “Built-in Objects” on the sidebar on the left.

As usual, let me know if you have any questions!


Sir… What are these math.floor() & math.ceiling()

1 Like

We don’t teach them in the app, but they are built in math functions. Math.floor rounds a number down, for example: Math.floor(1.34) would return 1.

Math.ceiling() rounds up.

You can read more about JavaScript’s math functions here.


Oh… ok. Thank you :slight_smile:

JS looks like an iceberg. There’s so much hidden under water. :grimacing:

1 Like

Thank you for this reply! I will surely check this ‘‘JavaScript documentation’’.

Hi, I’m Alexander :wink:.
I just completed grasshopper app and I want to learn more about JavaScript. Also, are those certificates I received valid for anything.

1 Like


Read this if you haven’t already

you,re only 15 and I’m only 13

Thanks a lot
I learned much from grasshopper. Do they have any courses ?

Wow! What an interesting and exciting journey into coding. The outlay of the Grasshopper program is superb. Introduction 1 & 2, thrusts somebody into coding. Was anticipating harder topics, but Array methods and Animation 1 & 2 were so cool, like sliding down a mountain top. Kudos to the Grasshopper team, you have really ‘lux fiat’ (show the light) in dark world of coding. You are ‘primus enterpere’ (best among equals) Will keep the coding vision alife. Thanks a lot.


I have learnt i lot of thing and i am currently making a small car racing game but i am not able to detect obstacle please tell how can i write a code that can do something when an object touches other please tell?

You can also learn coding with W3Schools. Also, you can learn coding with as well.

Pummarin :slightly_smiling_face:

Thank you Pummarin for the information.


Pls sir I was notified that you blocked my topic, and I confused. Pls I ain’t angry, but I just want to know why u did. Pls reply​:frowning::frowning::sob::disappointed_relieved::disappointed_relieved::cry::worried::cry::disappointed_relieved::white_large_square:

!!! ??? ! Who are you gentil man. First introduce yourself…

Anwriter. It has a free and paid version. The free supports only HTML CSS and JavaScript

Mam I am just of 13 years and have completed doing all grasshopper apps coding. What shall I do now? Mam please give suggestions

1 Like

Thanks soo much!! I’ll trie out some of the sources

@fallenangel74 The Coding that doctor’s offices use are placing procedures with a code for insurance identification, data entry. Where this is wiring the program that you would use to enter the data.

There’s much jargon, it can be confusing!

Dear @Grasshopper_Heather,

Could you please give me a link to the Grasshopper Support user tutorials? I can’t seem to find them anywhere!

I would greatly appreciate it!