Truly Random Number?

mikrubin's Avatar

mikrubin

30 May, 2014 05:42 PM

I need to generate a truly random number between 1 and 250. It appears the only way I can do this is by changing the seed. I could use RANDOM to change the seed, but you begin to see the problem...?

How can I generate a truly random number using Nodebox 3? What am I missing???

  1. 1 Posted by Mike Rubin on 02 Jun, 2014 06:33 PM

    Mike Rubin's Avatar

    Okay, I just wrote my own node and used it:

    import random
    def evaluate(i,j):
    k = random.randint(i, j)
    return k

  2. Support Staff 2 Posted by Stefan Gabriels on 03 Jun, 2014 08:42 AM

    Stefan Gabriels's Avatar

    There is no such thing as a true random number. We use a seed so that the same results can be reproduced later on, if we need it. Suppose you created a nice procedural graphic with random numbers but forgot to save it. Without a seed it could never be recreated again and lost forever. The closest thing to true randomization (if that's what you want) is to attach something like the current time to the seed parameter, but right now we don't have time nodes in nodebox yet (we will have them soon though). You could also try to roll your own in python.

  3. Stefan Gabriels closed this discussion on 03 Jun, 2014 08:42 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

10 Sep, 2024 03:41 AM
09 Sep, 2024 02:15 PM
07 Sep, 2024 05:16 AM
05 Sep, 2024 02:21 AM
04 Sep, 2024 05:01 AM

 

03 Sep, 2024 10:07 AM
02 Sep, 2024 05:56 AM
31 Aug, 2024 11:07 PM
27 Aug, 2024 12:08 AM
26 Aug, 2024 01:02 PM
26 Aug, 2024 07:18 AM