## Proper random number generation and radian/degree.

### Proper random number generation and radian/degree.

I have noticed that Löve uses the default pseudo-random number generator. I suggest that you in the next versions implement a proper random generation (avilable somewhere on lua.org). Also I suggest that you take a stand point and decide to either convert all Löve functions to radians or all lua functions to degrees (this can be done at loadup manually, but...).

I r awsum at looah

### Re: Proper random number generation and radian/degree.

Well, you are quite the suggestionist[1], aren't you?

You must have an average of two-three suggestions per day or something.

[1] Probably not a word.

You must have an average of two-three suggestions per day or something.

[1] Probably not a word.

### Re: Proper random number generation and radian/degree.

I think we brought up the degrees-vs-radians in another thread. One thing that kinda bugs me is rotations seem to be clock wise for increasing degrees. For a mathematician this is a little "upside-down", but it's easily solvable with a - in front

I would like to know what is the difference with the "proper" random generator and the pseudo random generator... specifically, when is it not a pseudo random generator. Afaik, there exist only pseudo random generators on computers, because they are deterministic.

I would like to know what is the difference with the "proper" random generator and the pseudo random generator... specifically, when is it not a pseudo random generator. Afaik, there exist only pseudo random generators on computers, because they are deterministic.

### Re: Proper random number generation and radian/degree.

I think the conventional understanding is that a pseudo-random function will use a deterministic function to supply the

As for radian and degrees, I think it unwise to change the behaviour of the standard lua math functions as people already accustomed to coding with lua/c/any-decent-language could easily be caught off guard.

*same sequence*of pseudo-random numbers every time it is reset, while a (non pseudo) random function will use a deterministic function with a changing seed (such as the current system time) to supply a*different sequence*of pseudo-random numbers each time it is reset.As for radian and degrees, I think it unwise to change the behaviour of the standard lua math functions as people already accustomed to coding with lua/c/any-decent-language could easily be caught off guard.

### Re: Proper random number generation and radian/degree.

May I humbly suggest that we implement the multiply-with-carry pseudo-random number generator? According to G. Marsaglia, it is better than Mersenne twister (current favorite) because it's fast AND provides better period. You can read about it here: http://en.wikipedia.org/wiki/Multiply-with-carry

### Re: Proper random number generation and radian/degree.

I think the nerd factor of this forum just spiked. Discussing the random number generator we should use. That's pretty hardcore.

Now posting

**IN STEREO**(where available)### Re: Proper random number generation and radian/degree.

So we just need to add math.randomseed( os.time() ) at the beginning of each program?subrime wrote:I think the conventional understanding is that a pseudo-random function will use a deterministic function to supply thesame sequenceof pseudo-random numbers every time it is reset, while a (non pseudo) random function will use a deterministic function with a changing seed (such as the current system time) to supply adifferent sequenceof pseudo-random numbers each time it is reset.

I concur!mike wrote:I think the nerd factor of this forum just spiked. Discussing the random number generator we should use. That's pretty hardcore.

### Re: Proper random number generation and radian/degree.

Lua will remain 100% standard and will not be changed. We'll have to change LÖVE if we want to change anything.

### Re: Proper random number generation and radian/degree.

Yes, that's the idea.u9_ wrote: So we just need to add math.randomseed( os.time() ) at the beginning of each program?

### Re: Proper random number generation and radian/degree.

Just a quick note - Lua's random number generator has problems with the first few numbers.

I suggest using
at the beginning of a program to get rid of these "bad" values.

I suggest using

Code: Select all

```
math.random()
math.random()
math.random()
```

### Who is online

Users browsing this forum: akopyl, Bing [Bot], Exabot [Bot], Google [Bot] and 5 guests