User parameter: random

User parameter: random

nkloski
Collaborator Collaborator
3,749 Views
13 Replies
Message 1 of 14

User parameter: random

nkloski
Collaborator
Collaborator

Hi all....I knwo that one can enter in mathematical formulas into various places in Fusion 360.

 

Is there a "random" value I can put in/use to create some organic randomness?

 

Thanks!


Nick Kloski
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Accepted solutions (2)
3,750 Views
13 Replies
Replies (13)
Message 2 of 14

martin.zatecka
Autodesk
Autodesk
Accepted solution

Hello,

 

I'm not aware of any random variable. However it is interesting idea. I would like to have the "random" variable oscillates in defined range of min and max.

please put your idea to http://forums.autodesk.com/t5/fusion-360-ideastation-request-a/idb-p/125

 

regards

Martin



Martin Zatecka
UX Designer
Message 3 of 14

nkloski
Collaborator
Collaborator

Done! Thanks!

 

http://forums.autodesk.com/t5/fusion-360-ideastation-request-a/please-add-in-quot-random-quot-number...

 


Nick Kloski
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 4 of 14

HughesTooling
Consultant
Consultant
Accepted solution

There is a random() Function available. Click on learning at the top of the screen, then form + modify panel  + change parameters for a list of functions.

Clipboard01.png

 

 

Mark.

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 5 of 14

HughesTooling
Consultant
Consultant

Ok just tried to use the random function and it makes Fusion crash. I set up a user parameter and random seems to give a random number between 0 and 1 but if you try and use it as a dimension eg. set up a parameter test using random() the in dimension use test*10 fusion crashes.

 

Mark.

 

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 6 of 14

martin.zatecka
Autodesk
Autodesk

Hello Mark,

 

thank you for your comment. My mistake, I missed the information about random() variable.

Please would you help me to reproduce the crash of Fusion?

I setup this example without any followed crash.

random.PNG

thank you

Martin

 



Martin Zatecka
UX Designer
0 Likes
Message 7 of 14

HughesTooling
Consultant
Consultant

Hello Martin

 

I tried to enter the equation directly into a dimension. Example draw a line, select dimension tool, pick line and type test*10.

 

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 8 of 14

martin.zatecka
Autodesk
Autodesk

nice catch 🙂 I'll ask for fix.

thank you

Martin



Martin Zatecka
UX Designer
0 Likes
Message 9 of 14

nkloski
Collaborator
Collaborator
Thanks! Yes, that does return a random number...is there a way to get it to (as suggested by you, Martin) oscillate between a certain range?...or just to return a number like "42" or "75"?

I tried using the "round" variable, but that did not seem to get the right response, it only returned numbers that were divisible by 10 (20, or 90, or 70).

Nick Kloski
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 10 of 14

martin.zatecka
Autodesk
Autodesk

Hello,

 

Let's try this:

Capture.PNG

random() returns numbers from 0 to 1

 

set maximal and minimal value, the formula "( random() * ( maxRange - minRange ) ) + minRange" calculates value in range of min and max.

for example: 

random = 0, min = 10, max = 20

formula: 0 * (20 - 10) + 10 = 10

 

random = 1, min = 10, max = 20

formula: 1 * (20 - 10) + 10 = 20

 

Do you want to adjust it, or it is ok?

regards

Martin

 

 



Martin Zatecka
UX Designer
Message 11 of 14

jeff.pek
Community Manager
Community Manager

Hi -

 

Typically, this would be done by multiplying the random number by the difference between the min and max values, and adding the min value. This sample is from a different language, but clarifies the approach:

 

// Returns a random integer between min and max
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

 

Hopefully we support the floor() function!

 

 Jeff

0 Likes
Message 12 of 14

HughesTooling
Consultant
Consultant

@nkloski wrote:

I tried using the "round" variable, but that did not seem to get the right response, it only returned numbers that were divisible by 10 (20, or 90, or 70).

I just trird round and it seems to work ok.

Clipboard01.png

 

Mark.

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 13 of 14

nkloski
Collaborator
Collaborator

Awesome!  Thanks, all!


Nick Kloski
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 14 of 14

joeX8245
Contributor
Contributor

Was this ever solved?

 

There are times where having  a randomly generated number that varies (in a range) when applied to a pattern for example would be very useful.

My goal is to have radii extend from a center point in random intervals between 15 and 25 deg.

 

I tried using: ( ( random() * ( ceil(25) - floor(15) ) ) * 1 deg ) + ( floor(15) ) * 1 deg

 

The formula compiled, but when I inserted it into the patterning tool, I got one value repeated. 

 

Could we add 'noise' as a variable?

 

I can imagine with some rounding and constraints, that could would provide a sample 'set'.

 

Is there a way to do this in Python or Java?

0 Likes