RE: Wishing well
"Mirar @ Pike importm?te f?r mailinglistan" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
I usually do this:
array res=({});
mapping done=([]);
for(int i=0;i<100;i++)
{
for(int j=0;j<100;j++)
{
int t=random(1);
string key=sort((array(string))({i,j,t}))*",";
if(!done[key])
{
res+=({(<i,j,t>)});
done[key]=1;
}
}
}
I do cast to string for cache-keys a lot. (And I usually use mappings
when I want a hashtable.)