ok so heres the issue, my app generates a lot of random content, i mean tons of the stuff. to avoid having it all sound to similier each part thats randomly generated has a lot of options.
so here is the issue im noticing when two items are created im getting a lot of matches.
heres an example, these two taverns were generated one after another :
see the last line? there is about 15 voices it could choose, not compelling evidence i now, here is the other two taverns the system generated (these would of been made a micro second after the first two, basicly two towns were generated and the taverns above were made when the first town was made and the second two made when the second town was made:
notice it picked the same coice again and the dead bard is duplicated (theres about 30 different lines that can go in that spot (some wich use other lines to for a near infinite varity)
I set up an instance of random when the class is first instanced with
then when ever i need a random number i do rnd.Next(MaxNumber) (ie rnd.Next(10) for a random number between 0 and 9)
any ideas on how to get a truely random number when doing rnd.Next ?
EDIT:
I googled a bit more and found that making a static class for random is considered better
the result:
That seems much more random,
for those that may stumble on to this via google
the class is
and to call a random number you simply
Sr.Instance.Next(minNumber,maxNumber) ie Sr.Instance.Next(0,9) for random number between 0 and 9
anyone know a better way im all ears
so here is the issue im noticing when two items are created im getting a lot of matches.
heres an example, these two taverns were generated one after another :
The hungover skunk, The hungover skunk is adorned with paintings of all its patrons. It has a somewhat shiny sawdust floor.
the patrons don't really care about strangers and will often just ignore them.
the bard at The hungover skunk is often accompanied by a dancing walrus.
The bar keep is a Dwarf with bright grey hair and a pair of goggles on his voice is so high-pitched its hard not to laugh.
The drowned tiger, The drowned tiger is rather run down. It has a old sawdust floor.
outsiders often feel they are trespassing when in The drowned tiger they know they are not welcome.
a cat is often brought out for people to fuss if they ask for a bard, no one really knows why.
The bar keep is a Elf with long fingernails and a cross eyed expression her voice is so high-pitched its hard not to laugh.
see the last line? there is about 15 voices it could choose, not compelling evidence i now, here is the other two taverns the system generated (these would of been made a micro second after the first two, basicly two towns were generated and the taverns above were made when the first town was made and the second two made when the second town was made:
The angry Dwarf, The angry Dwarf is is unpleasantly decorated, Dwarf ears are nailed to the wall above the bar.. It has a bloodstained wood floor.
this is not a tavern for strangers and they are informed of this very fast, often while being propelled from the establishment.
in the corner is a dead bard, it is apparently not uncommon for badly performing bards to be left there.
The bar keep is a Halfling with a black eye and a large pony tail on the back of her head her voice is so high-pitched its hard not to laugh.
The broken dove, The broken dove is is unpleasantly decorated, mounted Dwarf heads are nailed to the wall above the bar.. It has a somewhat shiny tiled floor.
few strangers ever go to The broken dove even fewer ever leave.
in the corner is a dead bard, it is apparently not uncommon for badly performing bards to be left there.
The bar keep is a Dwarf with red glowing eyes and a bald head her voice is deep and gravely.
notice it picked the same coice again and the dead bard is duplicated (theres about 30 different lines that can go in that spot (some wich use other lines to for a near infinite varity)
I set up an instance of random when the class is first instanced with
Code:
public Random rnd = new Random() ;
any ideas on how to get a truely random number when doing rnd.Next ?
EDIT:
I googled a bit more and found that making a static class for random is considered better
the result:
The sleazy bear, The sleazy bear is is unpleasantly decorated, thumbs are nailed to the wall above the bar.. It has a surprisingly clean sawdust floor.
this is not a tavern for strangers and they are informed of this very fast, often while being propelled from the establishment.
bards are not only forbidden from the The sleazy bear but people that try to sing often find a sudden inability to continue, throwing axes are funny like that.
The bar keep is a Elf with a large axe on his back and the air of importance about his his voice has no emotion in it.
The hungry Human, The hungry Human is painted multiple colours, its rather unsettling. It has a old chequered floor.
you really do not want to be a stranger in this tavern.
bards are not only forbidden from the The hungry Human but people that try to sing often find a sudden inability to continue, throwing axes are funny like that.
The bar keep is a Elf with a single monocle over his right eye and dirty hands his voice is rather unremarkable.
The fearful camel, The fearful camel is decorated with rough stone slab walls. It has a stained chequered floor.
there is no real atmosphere as the place is often empty.
bards are not only forbidden from the The fearful camel but people that try to sing often find a sudden inability to continue, throwing axes are funny like that.
The bar keep is a Human with a cheerful expression and red glowing eyes his voice has a distinct accent to it, though from where is hard to pinpoint.
The sad little Dwarf, The sad little Dwarf is decorated with the pelts of locally hunted animals. It has a new marbled floor.
few strangers ever go to The sad little Dwarf even fewer ever leave.
there is a bard at The sad little Dwarf patrons often get him too drunk to sing, for reasons that are all too apparent when he is sober.
The bar keep is a Dwarf with long fingernails and a small pet kitten on his shoulder his voice sounds like it came from the grave itself.
The horny bird, The horny bird is decorated with rough stone slab walls. It has a bloodstained granite floor.
this is not a tavern for strangers and they are informed of this very fast, often while being propelled from the establishment.
the inn is too small for a bard.
The bar keep is a Elf with a small pet lion on his shoulder and the smell of roses about his his voice has a distinct accent to it, though from where is hard to pinpoint.
That seems much more random,
for those that may stumble on to this via google
the class is
Code:
public static class Sr
{
private static int seed;
private static ThreadLocal<Random> threadLocal = new ThreadLocal<Random>
(() => new Random(Interlocked.Increment(ref seed)));
static Sr()
{
seed = Environment.TickCount;
}
public static Random Instance { get { return threadLocal.Value; } }
}
and to call a random number you simply
Sr.Instance.Next(minNumber,maxNumber) ie Sr.Instance.Next(0,9) for random number between 0 and 9
anyone know a better way im all ears
Last edited: