Function Error: cannot be read at compile time

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 4 10:25:51 PDT 2015


On Thursday, 4 June 2015 at 17:04:06 UTC, jmh530 wrote:
> 	float output[len];

This creates a fixed-sized array of length `len` (using the 
deprecated syntax). Since the length is part of the type, it 
needs to be known at compile time.

You probably want a dynamic array instead. `auto output = new 
float[len]`

Also note that you're not seeding your random number generator, 
so it will produce the same sequence every time. You probably 
want `auto gen = Random(unpredictableSeed);`


More information about the Digitalmars-d-learn mailing list