Real random numbers

Is it possible to generate real random numbers, not pseudo ones?
maybe somehow combing the seed with the current time?

Whilst I’m sure that David did the best in the GH native component … If you Google: real random numbers you’ll get several tons of articles (obviously related with coding).

And of course there’s the classic thingy were The Master talks:

I am just an architect, for me any real coding is unavailable.

OK, but why are you searching “real” randoms on the first place? Can you provide some test were randoms are not the randoms that you are after?

I want to generate a geomertry sequence with a push button.
Maybe I am wrong but I suspect but if I dont change the seed it will always generate the same random numbers when I press the button, that is way I guess I need the thing.

Well the attached is using the classic (so to speak) way to get Randoms. It ensures that are unique using something that accepts no dublicates (don’t bother with what that something is). Obviously playing with decimals and narrowing the range (whilst increasing the N) yields some missed calls as the info panel says.

I’ll add some lines more to indicate if the same randoms (or how many anyway) are made … if it re-executes a user defined amount of iterations. (7.0 KB)

One classical solution when using pseudo random to generate more random is to use the clock (in millisecond) to update the seed.
Here an example with Grasshopper in second. Double click on the Clock to update the output. Then feed the output of the expression to the seed of your random component

You can also use a random from a plugin heteroptera

Double click on the component to update.

in addition to all these the attached (using the same basic Random approach) makes random trees (unique numbers, that is) and then ckecks if there’s common numbers across all the branches. If the decimal precision is some decent one … well … there’s a rather limited (if any at all) danger for dupes … at least for real-life geometry related stuff (or I believe so anyway). (9.7 KB)

Thank you very much! works perfectly!

Thanks a lot! The problem is that I am building Human UI, therefore anything when the user has the click on Grasshopper work area does not work for now.

Only if you have access to a source of genuine randomness. Computers are deterministic machines as as such cannot exhibit genuinely random behaviour. Brian Hayes has a decent introductory lecture on randomness, notes.

Common sources of genuine randomness are Geiger counters and keyboard events and video/audio recordings. The basic idea is that you record a signal and strip away the most significant frequencies, you should then be left with genuine randomness. In the case of key-press events, imagine that you type at the average speed of 5 keys per second. The computer will record the exact time between presses and only look at the number of remaining milliseconds after whole seconds, tenths of seconds and hundreds of seconds have been subtracted. The number of remaining milliseconds should give you a proper random distribution between 0 and 1000.

The problem with genuine random numbers is that (a) it is expensive or time consuming to make them and (b) you cannot repeat them. This is why usually a genuine random number is merely used to initiate a pseudo-random sequence which is much longer.

As you have a trigger in the UI it is easy to use it to change the random numbers. Here an example with Remote Panel, must be the same with Human UI

The toggle is true or false so it generate a list of (true, false) then (false, true) … so the dispatch will alternatively send a 10 or a 10. But Grashopper did not test if value are the same so the random component is recalculated. There are many many solutions …

thank you. I have a different random widget which has a seed input. Is it also a basic grasshopper widget?

This one is Heteroptera, it accept not a seed but a number of random numbers, if this number change (or not if we cheat) there is a recalculation.

I made a little script with output a millisecond date

Inside it didn’t use the X, just do that
DateTime localDate = DateTime.Now;
_ A = localDate.Millisecond;_
But there is an update each time you click on toggle.
random (5.3 KB)

Is it possible to generate real random numbers, not pseudo ones?

Yes, with quantum computing.

Thx, very nice solution! Works for me too!