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

22 Feb, 2024 05:51 AM
22 Feb, 2024 01:11 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM
16 Feb, 2024 05:24 PM

 

06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM
04 Jan, 2024 11:49 PM